1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Scorecard
# OpenSSF Scorecard — analyses the repo's security posture (branch protection,
# token permissions, pinned dependencies, etc.) and publishes the result so the
# README badge and https://securityscorecards.dev viewer can display it.
on:
# Re-evaluate when branch protection rules change.
branch_protection_rule:
# Weekly, to keep the score fresh.
schedule:
- cron: "20 7 * * 1"
push:
branches:
# Read-only by default; individual jobs elevate only what they need.
permissions: read-all
jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
security-events: write # upload results to the code-scanning dashboard
id-token: write # OIDC token to publish results to the OpenSSF API
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Run analysis
uses: ossf/scorecard-action@v2.4.3
with:
results_file: results.sarif
results_format: sarif
# Required for the public badge + securityscorecards.dev viewer.
publish_results: true
# Keep the SARIF as an artifact for inspection.
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Surface findings in the repo's Security → Code scanning tab.
- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: results.sarif