ci: Add step-security/harden-runner
to all CI steps
#65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Scorecards supply-chain security | |
permissions: read-all | |
on: | |
branch_protection_rule: | |
schedule: | |
- cron: '38 12 * * 1' | |
push: | |
branches: [ "main" ] | |
jobs: | |
analysis: | |
name: Scorecards analysis | |
runs-on: ubuntu-latest | |
permissions: | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
id-token: write # for ossf/scorecard-action to access GitHub's OIDC token when publishing | |
steps: | |
- uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- name: "Checkout code" | |
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 | |
with: | |
persist-credentials: false | |
- name: "Run analysis" | |
uses: ossf/scorecard-action@ce330fde6b1a5c9c75b417e7efc510b822a35564 # v1.1.2 | |
with: | |
results_file: results.sarif | |
results_format: sarif | |
repo_token: ${{ secrets.SCORECARD_TOKEN }} | |
publish_results: true | |
- name: "Upload artifact" | |
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 | |
with: | |
name: SARIF file | |
path: results.sarif | |
retention-days: 5 | |
# Upload the results to GitHub's code scanning dashboard. | |
- name: "Upload to code-scanning" | |
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26 | |
with: | |
sarif_file: results.sarif |