Skip to content

Commit 7b5b356

Browse files
authored
chore: Add OSSF scorecard
1 parent 0750644 commit 7b5b356

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/scorecard.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
on:
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9+
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12+
schedule:
13+
- cron: '44 19 * * 2'
14+
workflow_dispatch:
15+
push:
16+
branches: [ "main" ]
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+
# `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
26+
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
27+
permissions:
28+
# Needed to upload the results to code-scanning dashboard.
29+
security-events: write
30+
# Needed to publish results and get a badge (see publish_results below).
31+
id-token: write
32+
# Uncomment the permissions below if installing in a private repository.
33+
# contents: read
34+
# actions: read
35+
36+
steps:
37+
- name: "Checkout code"
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
with:
40+
persist-credentials: false
41+
42+
- name: "Run analysis"
43+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
44+
with:
45+
results_file: results.sarif
46+
results_format: sarif
47+
publish_results: true
48+
49+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
50+
# format to the repository Actions tab.
51+
- name: "Upload artifact"
52+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
53+
with:
54+
name: SARIF file
55+
path: results.sarif
56+
retention-days: 5
57+
58+
# Upload the results to GitHub's code scanning dashboard (optional).
59+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
60+
- name: "Upload to code-scanning"
61+
uses: github/codeql-action/upload-sarif@v3
62+
with:
63+
sarif_file: results.sarif

0 commit comments

Comments
 (0)