Skip to content

Commit 0b1fe5a

Browse files
ci: add support for OSSF scorecard reporting (#24)
PR-URL: #24
1 parent 63f4e26 commit 0b1fe5a

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/scorecard.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
# Uncomment the permissions below if installing in a private repository.
31+
# contents: read
32+
# actions: read
33+
34+
steps:
35+
- name: "Checkout code"
36+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
37+
with:
38+
persist-credentials: false
39+
40+
- name: "Run analysis"
41+
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
42+
with:
43+
results_file: results.sarif
44+
results_format: sarif
45+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
46+
# - you want to enable the Branch-Protection check on a *public* repository, or
47+
# - you are installing Scorecard on a *private* repository
48+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
49+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
50+
51+
# Public repositories:
52+
# - Publish results to OpenSSF REST API for easy access by consumers
53+
# - Allows the repository to include the Scorecard badge.
54+
# - See https://github.com/ossf/scorecard-action#publishing-results.
55+
# For private repositories:
56+
# - `publish_results` will always be set to `false`, regardless
57+
# of the value entered here.
58+
publish_results: true
59+
60+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
61+
# format to the repository Actions tab.
62+
- name: "Upload artifact"
63+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
64+
with:
65+
name: SARIF file
66+
path: results.sarif
67+
retention-days: 5
68+
69+
# Upload the results to GitHub's code scanning dashboard.
70+
- name: "Upload to code-scanning"
71+
uses: github/codeql-action/upload-sarif@2f93e4319b2f04a2efc38fa7f78bd681bc3f7b2f # v2.23.2
72+
with:
73+
sarif_file: results.sarif

0 commit comments

Comments
 (0)