Skip to content

Commit adc025c

Browse files
committed
fix(ci): update Scorecard workflow configuration and permissions
1 parent e843bf9 commit adc025c

1 file changed

Lines changed: 51 additions & 10 deletions

File tree

.github/workflows/scorecard.yml

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,78 @@
1-
name: Scorecard supply-chain security
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.
24

5+
name: Scorecard supply-chain security
36
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
49
branch_protection_rule:
5-
push:
6-
branches: [main]
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
712
schedule:
8-
- cron: '0 6 * * 1' # weekly, Monday 06:00 UTC
13+
- cron: '27 21 * * 3'
14+
push:
15+
branches: [ "main" ]
916

17+
# Declare default permissions as read only.
1018
permissions: read-all
1119

1220
jobs:
1321
analysis:
1422
name: Scorecard analysis
1523
runs-on: ubuntu-latest
24+
# `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
25+
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
1626
permissions:
27+
# Needed to upload the results to code-scanning dashboard.
1728
security-events: write
29+
# Needed to publish results and get a badge (see publish_results below).
1830
id-token: write
19-
contents: read
20-
actions: read
31+
# Uncomment the permissions below if installing in a private repository.
32+
# contents: read
33+
# actions: read
34+
2135
steps:
22-
- uses: actions/checkout@v4
36+
- name: "Checkout code"
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2338
with:
2439
persist-credentials: false
25-
- uses: ossf/scorecard-action@v2.4.3
40+
41+
- name: "Run analysis"
42+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
2643
with:
2744
results_file: results.sarif
2845
results_format: sarif
46+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
47+
# - you want to enable the Branch-Protection check on a *public* repository, or
48+
# - you are installing Scorecard on a *private* repository
49+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
50+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
51+
52+
# Public repositories:
53+
# - Publish results to OpenSSF REST API for easy access by consumers
54+
# - Allows the repository to include the Scorecard badge.
55+
# - See https://github.com/ossf/scorecard-action#publishing-results.
56+
# For private repositories:
57+
# - `publish_results` will always be set to `false`, regardless
58+
# of the value entered here.
2959
publish_results: true
30-
- uses: actions/upload-artifact@v4
60+
61+
# (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore
62+
# file_mode: git
63+
64+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
65+
# format to the repository Actions tab.
66+
- name: "Upload artifact"
67+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
3168
with:
3269
name: SARIF file
3370
path: results.sarif
3471
retention-days: 5
35-
- uses: github/codeql-action/upload-sarif@v3
72+
73+
# Upload the results to GitHub's code scanning dashboard (optional).
74+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
75+
- name: "Upload to code-scanning"
76+
uses: github/codeql-action/upload-sarif@v3
3677
with:
3778
sarif_file: results.sarif

0 commit comments

Comments
 (0)