|
1 | | -name: OpenSSF Scorecard |
| 1 | +# This workflow uses actions that are not certified by GitHub. They are provided |
| 2 | +# by a third-party and are governed by separate terms of service, privacy |
| 3 | +# policy, and support documentation. |
2 | 4 |
|
| 5 | +name: Scorecard supply-chain security |
3 | 6 | on: |
4 | | - # Run on pushes to main/master branch |
5 | | - push: |
6 | | - branches: [master, main] |
7 | | - # Run weekly on Monday at 00:00 UTC |
| 7 | + # For Branch-Protection check. Only the default branch is supported. See |
| 8 | + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection |
| 9 | + branch_protection_rule: |
| 10 | + # To guarantee Maintained check is occasionally updated. See |
| 11 | + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained |
8 | 12 | schedule: |
9 | | - - cron: '0 0 * * 1' |
10 | | - # Allow manual triggering |
11 | | - workflow_dispatch: |
| 13 | + - cron: '15 7 * * 4' |
| 14 | + push: |
| 15 | + branches: [ "master" ] |
12 | 16 |
|
13 | | -# Declare default permissions as read only |
| 17 | +# Declare default permissions as read only. |
14 | 18 | permissions: read-all |
15 | 19 |
|
16 | 20 | jobs: |
17 | 21 | analysis: |
18 | 22 | name: Scorecard analysis |
19 | 23 | runs-on: ubuntu-latest |
| 24 | + # `publish_results: true` only works when run from the default branch. conditional can be removed if disabled. |
| 25 | + if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request' |
20 | 26 | permissions: |
21 | | - # Needed for Code Scanning upload |
| 27 | + # Needed to upload the results to code-scanning dashboard. |
22 | 28 | security-events: write |
23 | | - # Needed for GitHub OIDC token |
| 29 | + # Needed to publish results and get a badge (see publish_results below). |
24 | 30 | id-token: write |
25 | | - # Needed for Scorecard to read repo contents |
26 | | - contents: read |
27 | | - # Needed for Scorecard to read repo metadata |
28 | | - actions: read |
| 31 | + # Uncomment the permissions below if installing in a private repository. |
| 32 | + # contents: read |
| 33 | + # actions: read |
29 | 34 |
|
30 | 35 | steps: |
31 | | - - name: Checkout code |
32 | | - uses: actions/checkout@v4 |
| 36 | + - name: "Checkout code" |
| 37 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
33 | 38 | with: |
34 | 39 | persist-credentials: false |
35 | 40 |
|
36 | | - - name: Run OpenSSF Scorecard |
37 | | - |
| 41 | + - name: "Run analysis" |
| 42 | + uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 |
38 | 43 | with: |
39 | 44 | results_file: results.sarif |
40 | 45 | results_format: sarif |
41 | | - # Publish results to OpenSSF REST API |
42 | | - # This allows the badge to be displayed on the repo |
| 46 | + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: |
| 47 | + # - you want to enable the Branch-Protection check on a *public* repository, or |
| 48 | + # - you are installing Scorecard on a *private* repository |
| 49 | + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. |
| 50 | + # repo_token: ${{ secrets.SCORECARD_TOKEN }} |
| 51 | + |
| 52 | + # Public repositories: |
| 53 | + # - Publish results to OpenSSF REST API for easy access by consumers |
| 54 | + # - Allows the repository to include the Scorecard badge. |
| 55 | + # - See https://github.com/ossf/scorecard-action#publishing-results. |
| 56 | + # For private repositories: |
| 57 | + # - `publish_results` will always be set to `false`, regardless |
| 58 | + # of the value entered here. |
43 | 59 | publish_results: true |
44 | 60 |
|
45 | | - - name: Upload Scorecard results to GitHub Security tab |
| 61 | + # (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore |
| 62 | + # file_mode: git |
| 63 | + |
| 64 | + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF |
| 65 | + # format to the repository Actions tab. |
| 66 | + - name: "Upload artifact" |
| 67 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 68 | + with: |
| 69 | + name: SARIF file |
| 70 | + path: results.sarif |
| 71 | + retention-days: 5 |
| 72 | + |
| 73 | + # Upload the results to GitHub's code scanning dashboard (optional). |
| 74 | + # Commenting out will disable upload of results to your repo's Code Scanning dashboard |
| 75 | + - name: "Upload to code-scanning" |
46 | 76 | uses: github/codeql-action/upload-sarif@v3 |
47 | 77 | with: |
48 | 78 | sarif_file: results.sarif |
0 commit comments