Skip to content

Commit 507a6c9

Browse files
authored
Add OpenSSF Scorecard (#356)
1 parent b3b403b commit 507a6c9

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/scorecards.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: OpenSSF Scorecards
2+
on:
3+
branch_protection_rule:
4+
schedule:
5+
- cron: "36 15 * * 3" # run every Wednesday at 15:36 UTC
6+
push:
7+
branches:
8+
- main
9+
10+
# Declare default permissions as read only.
11+
permissions: read-all
12+
13+
jobs:
14+
analysis:
15+
name: Scorecard analysis
16+
runs-on: ubuntu-22.04
17+
permissions:
18+
# Needed to upload the results to code-scanning dashboard.
19+
security-events: write
20+
# Needed to publish results and get a badge (see publish_results below).
21+
id-token: write
22+
# Uncomment the permissions below if installing in a private repository.
23+
# contents: read
24+
# actions: read
25+
26+
steps:
27+
- name: "Checkout code"
28+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
29+
with:
30+
persist-credentials: false
31+
32+
- name: "Run analysis"
33+
uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0
34+
with:
35+
results_file: results.sarif
36+
results_format: sarif
37+
repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
38+
39+
# Public repositories:
40+
# - Publish results to OpenSSF REST API for easy access by consumers
41+
# - Allows the repository to include the Scorecard badge.
42+
# - See https://github.com/ossf/scorecard-action#publishing-results.
43+
# For private repositories:
44+
# - `publish_results` will always be set to `false`, regardless
45+
# of the value entered here.
46+
publish_results: true
47+
48+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
49+
# format to the repository Actions tab.
50+
- name: "Upload artifact"
51+
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
52+
with:
53+
name: SARIF file
54+
path: results.sarif
55+
retention-days: 5
56+
57+
# Upload the results to GitHub's code scanning dashboard.
58+
- name: "Upload to code-scanning"
59+
uses: github/codeql-action/upload-sarif@1813ca74c3faaa3a2da2070b9b8a0b3e7373a0d8 # v2.21.0
60+
with:
61+
sarif_file: results.sarif

0 commit comments

Comments
 (0)