Skip to content

Commit c0a071a

Browse files
chore: add support for OSSF scorecard reporting (#163)
PR-URL: #163
1 parent 9b5a12a commit c0a071a

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/scorecard.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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.
4+
5+
name: Scorecard supply-chain security
6+
7+
on:
8+
# For Branch-Protection check. Only the default branch is supported. See
9+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
10+
branch_protection_rule:
11+
# To guarantee Maintained check is occasionally updated. See
12+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
13+
schedule:
14+
- cron: '16 21 * * 1'
15+
push:
16+
branches: [ "master" ]
17+
18+
# Declare default permissions as read only.
19+
permissions: read-all
20+
21+
jobs:
22+
analysis:
23+
name: Scorecard analysis
24+
runs-on: ubuntu-latest
25+
permissions:
26+
# Needed to upload the results to code-scanning dashboard.
27+
security-events: write
28+
# Needed to publish results and get a badge (see publish_results below).
29+
id-token: write
30+
31+
steps:
32+
- name: "Checkout code"
33+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
34+
with:
35+
persist-credentials: false
36+
37+
- name: "Run analysis"
38+
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
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#authentication-with-pat.
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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
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.
67+
- name: "Upload to code-scanning"
68+
uses: github/codeql-action/upload-sarif@2f93e4319b2f04a2efc38fa7f78bd681bc3f7b2f # v2.23.2
69+
with:
70+
sarif_file: results.sarif

0 commit comments

Comments
 (0)