| 1 |
name: OpenSSF Scorecard |
| 2 |
on: |
| 3 |
# For Branch-Protection check. Only the default branch is supported. See |
| 4 |
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection |
| 5 |
branch_protection_rule: |
| 6 |
# To guarantee Maintained check is occasionally updated. See |
| 7 |
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained |
| 8 |
push: |
| 9 |
branches: [main] |
| 10 |
workflow_dispatch: |
| 11 |
|
| 12 |
permissions: |
| 13 |
contents: read |
| 14 |
|
| 15 |
concurrency: |
| 16 |
group: scorecard-${{ github.ref }} |
| 17 |
cancel-in-progress: true |
| 18 |
|
| 19 |
jobs: |
| 20 |
analysis: |
| 21 |
name: Scorecard analysis |
| 22 |
runs-on: ubuntu-latest |
| 23 |
environment: |
| 24 |
name: scorecard |
| 25 |
deployment: false # Prevents creating a GitHub deployment object |
| 26 |
permissions: |
| 27 |
contents: read |
| 28 |
security-events: write # allow uploading code scanning results |
| 29 |
id-token: write # to allow OIDC authentication for publishing results to OpenSSF REST API |
| 30 |
|
| 31 |
steps: |
| 32 |
- name: "Checkout code" |
| 33 |
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| 34 |
with: |
| 35 |
persist-credentials: false |
| 36 |
|
| 37 |
- name: "Run analysis" |
| 38 |
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a |
| 39 |
with: |
| 40 |
results_file: results.sarif |
| 41 |
results_format: sarif |
| 42 |
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if: |
| 43 |
# - you want to enable the Branch-Protection check on a *public* repository, or |
| 44 |
# - you are installing Scorecard on a *private* repository |
| 45 |
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. |
| 46 |
repo_token: ${{ secrets.SCORECARD_TOKEN }} |
| 47 |
|
| 48 |
# Public repositories: |
| 49 |
# - Publish results to OpenSSF REST API for easy access by consumers |
| 50 |
# - Allows the repository to include the Scorecard badge. |
| 51 |
# - See https://github.com/ossf/scorecard-action#publishing-results. |
| 52 |
# For private repositories: |
| 53 |
# - `publish_results` will always be set to `false`, regardless |
| 54 |
# of the value entered here. |
| 55 |
publish_results: true |
| 56 |
|
| 57 |
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF |
| 58 |
# format to the repository Actions tab. |
| 59 |
- name: "Upload artifact" |
| 60 |
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a |
| 61 |
with: |
| 62 |
name: SARIF file |
| 63 |
path: results.sarif |
| 64 |
retention-days: 5 |
| 65 |
|
| 66 |
# Upload the results to GitHub's code scanning dashboard (optional). |
| 67 |
# Commenting out will disable upload of results to your repo's Code Scanning dashboard |
| 68 |
- name: "Upload to code-scanning" |
| 69 |
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e |
| 70 |
with: |
| 71 |
sarif_file: results.sarif |