|
| 1 | +--- |
| 2 | +# This workflow uses actions that are not certified by GitHub. They are provided |
| 3 | +# by a third-party and are governed by separate terms of service, privacy |
| 4 | +# policy, and support documentation. |
| 5 | + |
| 6 | +name: Scorecard supply-chain security |
| 7 | +on: |
| 8 | + # For Branch-Protection check. Only the default branch is supported. See |
| 9 | + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection |
| 10 | + branch_protection_rule: |
| 11 | + # To guarantee Maintained check is occasionally updated. See |
| 12 | + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained |
| 13 | + schedule: |
| 14 | + - cron: 35 1 * * 6 |
| 15 | + push: |
| 16 | + branches: [main] |
| 17 | + |
| 18 | +# Declare default permissions as read only. |
| 19 | +permissions: read-all |
| 20 | + |
| 21 | +jobs: |
| 22 | + analysis: |
| 23 | + name: Scorecard analysis |
| 24 | + runs-on: ubuntu-latest |
| 25 | + permissions: |
| 26 | + # Needed to upload the results to code-scanning dashboard. |
| 27 | + security-events: write |
| 28 | + # Needed to publish results and get a badge (see publish_results below). |
| 29 | + id-token: write |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Harden Runner |
| 33 | + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 |
| 34 | + with: |
| 35 | + egress-policy: audit |
| 36 | + |
| 37 | + - uses: actions/create-github-app-token@af35edadc00be37caa72ed9f3e6d5f7801bfdf09 # v1.11.7 |
| 38 | + id: gh-app-token |
| 39 | + with: |
| 40 | + app-id: ${{ vars.GH_APP_ID }} |
| 41 | + private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} |
| 42 | + |
| 43 | + - name: Checkout code |
| 44 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 45 | + with: |
| 46 | + persist-credentials: false |
| 47 | + token: ${{ steps.gh-app-token.outputs.token }} |
| 48 | + |
| 49 | + - name: Run analysis |
| 50 | + uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 |
| 51 | + with: |
| 52 | + results_file: results.sarif |
| 53 | + results_format: sarif |
| 54 | + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: |
| 55 | + # - you want to enable the Branch-Protection check on a *public* repository, or |
| 56 | + # - you are installing Scorecard on a *private* repository |
| 57 | + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. |
| 58 | + repo_token: ${{ steps.gh-app-token.outputs.token }} |
| 59 | + |
| 60 | + # Public repositories: |
| 61 | + # - Publish results to OpenSSF REST API for easy access by consumers |
| 62 | + # - Allows the repository to include the Scorecard badge. |
| 63 | + # - See https://github.com/ossf/scorecard-action#publishing-results. |
| 64 | + publish_results: true |
| 65 | + |
| 66 | + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF |
| 67 | + # format to the repository Actions tab. |
| 68 | + - name: Upload artifact |
| 69 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 70 | + with: |
| 71 | + name: SARIF file |
| 72 | + path: results.sarif |
| 73 | + retention-days: 5 |
| 74 | + |
| 75 | + # Upload the results to GitHub's code scanning dashboard. |
| 76 | + - name: Upload to code-scanning |
| 77 | + uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15 |
| 78 | + with: |
| 79 | + sarif_file: results.sarif |
0 commit comments