diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml index 974405b22da..eb46758d1ad 100644 --- a/.github/workflows/scorecard.yaml +++ b/.github/workflows/scorecard.yaml @@ -9,6 +9,9 @@ on: schedule: # Weekly on Mondays at 00:00. - cron: '0 0 * * 1' + workflow_dispatch: + pull_request: + # The OSSF recommendation encourages to enable branch protection rules trigger # to update the scorecard @@ -20,7 +23,6 @@ on: push: branches: [ "master" ] -# Declare default permissions as read only. permissions: read-all jobs: @@ -35,13 +37,30 @@ jobs: # Uncomment the permissions below if installing in a private repository. # contents: read # actions: read + pull-requests: write steps: + + - name: Eco CI Energy Estimation - Initialize + uses: green-coding-solutions/eco-ci-energy-estimation@main + with: + task: start-measurement + continue-on-error: true + + - name: "Checkout code" uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 with: persist-credentials: false + - name: Eco CI Energy Estimation - Get Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@main + with: + task: get-measurement + label: Checkout code + continue-on-error: true + + - name: "Run analysis" uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2 with: @@ -60,7 +79,16 @@ jobs: # For private repositories: # - `publish_results` will always be set to `false`, regardless # of the value entered here. - publish_results: true + publish_results: false + + - name: Eco CI Energy Estimation - Get Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@main + with: + task: get-measurement + label: Run analysis + continue-on-error: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. @@ -71,9 +99,35 @@ jobs: path: results.sarif retention-days: 5 + - name: Eco CI Energy Estimation - Get Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@main + with: + task: get-measurement + label: Upload artifact + continue-on-error: true + + + # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4 with: sarif_file: results.sarif + - name: Eco CI Energy Estimation - Get Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@main + with: + task: get-measurement + label: Upload to code-scanning + continue-on-error: true + + + + - name: Eco CI Energy Estimation - End Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@main + with: + task: display-results + pr-comment: true + continue-on-error: true + +