|
| 1 | +name: OpenSSF Scorecard |
| 2 | + |
| 3 | +on: |
| 4 | + # Run on every push to master so the score reflects the current default branch. |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + # Run weekly to catch score changes driven by external factors (new checks, upstream CVEs, etc). |
| 9 | + schedule: |
| 10 | + - cron: '30 1 * * 6' |
| 11 | + # Run whenever branch protection rules change, as that directly affects the score. |
| 12 | + branch_protection_rule: |
| 13 | + |
| 14 | +# Required by the Scorecard publish API to verify the workflow identity via OIDC. |
| 15 | +# The server-side enforcement for publish_results: true requires permissions: read-all at the |
| 16 | +# workflow level and prohibits top-level env: or defaults: blocks. |
| 17 | +permissions: read-all |
| 18 | + |
| 19 | +jobs: |
| 20 | + scorecard: |
| 21 | + name: scorecard |
| 22 | + runs-on: ubuntu-latest |
| 23 | + permissions: |
| 24 | + # Required to upload SARIF results to the GitHub Security tab. |
| 25 | + security-events: write |
| 26 | + # Required for keyless OIDC token used to publish results to the public Scorecard API. |
| 27 | + id-token: write |
| 28 | + # Required to read workflow files and repository contents for analysis. |
| 29 | + contents: read |
| 30 | + actions: read |
| 31 | + steps: |
| 32 | + # Checkout without persisting credentials — Scorecard's server-side enforcement requires this |
| 33 | + # to prevent the workflow from being used to exfiltrate tokens. |
| 34 | + - name: Checkout code |
| 35 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 36 | + with: |
| 37 | + persist-credentials: false |
| 38 | + |
| 39 | + # Run the Scorecard analysis against this repository. publish_results: true pushes the score |
| 40 | + # to the public Scorecard API (api.scorecard.dev) and enables the README badge. Results are |
| 41 | + # also uploaded to the GitHub Security tab as SARIF alerts in the next step. |
| 42 | + - name: Run Scorecard analysis |
| 43 | + uses: ossf/scorecard-action@99c09fe975337306107572b4fdf4db224cf8e2f2 # v2.4.3 |
| 44 | + id: scorecard |
| 45 | + with: |
| 46 | + results_file: scorecard-results.sarif |
| 47 | + results_format: sarif |
| 48 | + publish_results: true |
| 49 | + |
| 50 | + # Upload Scorecard findings to the GitHub Security tab so each failing check appears as an |
| 51 | + # individual code scanning alert with remediation guidance. |
| 52 | + - name: Upload Scorecard results to GitHub Security tab |
| 53 | + uses: github/codeql-action/upload-sarif@cb06a0a8527b2c6970741b3a0baa15231dc74a4c # v4.34.1 |
| 54 | + with: |
| 55 | + sarif_file: scorecard-results.sarif |
0 commit comments