Skip to content

Commit 5160371

Browse files
authored
Add OpenSSF Scorecard workflow (#890)
This PR adds a nightly workflow to run [OpenSSF Scorecard](https://openssf.org/projects/scorecard/), a code-scanning system recommended by Google's GitHub OSS team. Once it starts running, Scorecard will create and update a report page at the following URL: <https://scorecard.dev/viewer/?uri=github.com/quantumlib/Stim> As an example, here's the page for Cirq: <https://scorecard.dev/viewer/?uri=github.com/quantumlib/Cirq>
1 parent 3163ebd commit 5160371

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/ossf-scorecard.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Summary: workflow for OSSF Scorecard (https://github.com/ossf/scorecard).
2+
#
3+
# Scorecard is an automated tool that assesses a number of important heuristics
4+
# associated with software security and assigns each check a score of 0-10. The
5+
# use of Scorecard is suggested in Google's internal GitHub guidance
6+
# (go/github-docs).
7+
#
8+
# Scorecard creates a report page at the following URL (for a repo ORG/REPO):
9+
# https://scorecard.dev/viewer/?uri=github.com/ORG/REPO
10+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11+
12+
name: Scorecard code scan
13+
run-name: Run Scorecard code scan
14+
15+
on:
16+
schedule:
17+
- cron: '19 20 * * 6'
18+
19+
# Allow manual invocation.
20+
workflow_dispatch:
21+
22+
# Declare default permissions as read only.
23+
permissions: read-all
24+
25+
# Cancel any previously-started but still active runs on the same branch.
26+
concurrency:
27+
cancel-in-progress: true
28+
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
29+
30+
jobs:
31+
scorecard:
32+
name: Perform Scorecard analysis
33+
runs-on: ubuntu-22.04
34+
timeout-minutes: 10
35+
permissions:
36+
# Needed to upload the results to the code-scanning dashboard.
37+
security-events: write
38+
# Needed to publish results and get a badge (see publish_results below).
39+
id-token: write
40+
steps:
41+
- name: Check out a copy of the git repository
42+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43+
with:
44+
persist-credentials: false
45+
46+
- name: Run Scorecard analysis
47+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
48+
with:
49+
# Save the results
50+
results_file: results.sarif
51+
results_format: sarif
52+
53+
# Publish results to OpenSSF REST API.
54+
# See https://github.com/ossf/scorecard-action#publishing-results.
55+
publish_results: true
56+
57+
- name: Upload results to code-scanning dashboard
58+
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3
59+
with:
60+
sarif_file: results.sarif

0 commit comments

Comments
 (0)