Skip to content

Commit 57a9876

Browse files
committed
Update OSSF CI
1 parent 47c99e6 commit 57a9876

2 files changed

Lines changed: 73 additions & 56 deletions

File tree

Lines changed: 73 additions & 0 deletions
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+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
11+
12+
# Declare default permissions as read only.
13+
permissions: read-all
14+
15+
jobs:
16+
analysis:
17+
name: Scorecard analysis
18+
runs-on: ubuntu-latest
19+
# `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
20+
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
21+
permissions:
22+
# Needed to upload the results to code-scanning dashboard.
23+
security-events: write
24+
# Needed to publish results and get a badge (see publish_results below).
25+
id-token: write
26+
# Uncomment the permissions below if installing in a private repository.
27+
# contents: read
28+
# actions: read
29+
30+
steps:
31+
- name: "Checkout code"
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
with:
34+
persist-credentials: false
35+
36+
- name: "Run analysis"
37+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
38+
with:
39+
results_file: results.sarif
40+
results_format: sarif
41+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
42+
# - you want to enable the Branch-Protection check on a *public* repository, or
43+
# - you are installing Scorecard on a *private* repository
44+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
45+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
46+
47+
# Public repositories:
48+
# - Publish results to OpenSSF REST API for easy access by consumers
49+
# - Allows the repository to include the Scorecard badge.
50+
# - See https://github.com/ossf/scorecard-action#publishing-results.
51+
# For private repositories:
52+
# - `publish_results` will always be set to `false`, regardless
53+
# of the value entered here.
54+
publish_results: true
55+
56+
# (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore
57+
# file_mode: git
58+
59+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
60+
# format to the repository Actions tab.
61+
- name: "Upload artifact"
62+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
63+
with:
64+
name: SARIF file
65+
path: results.sarif
66+
retention-days: 5
67+
68+
# Upload the results to GitHub's code scanning dashboard (optional).
69+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
70+
- name: "Upload to code-scanning"
71+
uses: github/codeql-action/upload-sarif@v3
72+
with:
73+
sarif_file: results.sarif

.github/workflows/ci.yml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -281,59 +281,3 @@ jobs:
281281
if: matrix.coverage
282282
with:
283283
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
284-
285-
OSSF-Scorecard:
286-
name: OSSF Scorecard
287-
runs-on: ubuntu-22.04
288-
permissions:
289-
# Needed to upload the results to code-scanning dashboard.
290-
security-events: write
291-
# Needed to publish results and get a badge (see publish_results below).
292-
id-token: write
293-
# Uncomment the permissions below if installing in a private repository.
294-
# contents: read
295-
# actions: read
296-
297-
steps:
298-
- name: Harden Runner
299-
uses: step-security/harden-runner@v2
300-
with:
301-
egress-policy: audit
302-
303-
- name: "Checkout code"
304-
uses: actions/checkout@v4
305-
with:
306-
persist-credentials: false
307-
308-
- name: "Run analysis"
309-
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
310-
with:
311-
results_file: results.sarif
312-
results_format: sarif
313-
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
314-
# - you want to enable the Branch-Protection check on a *public* repository, or
315-
# - you are installing Scorecard on a *private* repository
316-
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
317-
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
318-
319-
# Public repositories:
320-
# - Publish results to OpenSSF REST API for easy access by consumers
321-
# - Allows the repository to include the Scorecard badge.
322-
# - See https://github.com/ossf/scorecard-action#publishing-results.
323-
publish_results: true
324-
325-
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
326-
# format to the repository Actions tab.
327-
- name: "Upload artifact"
328-
uses: actions/upload-artifact@v3
329-
with:
330-
name: SARIF file
331-
path: results.sarif
332-
retention-days: 5
333-
334-
# Upload the results to GitHub's code scanning dashboard (optional).
335-
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
336-
- name: "Upload to code-scanning"
337-
uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
338-
with:
339-
sarif_file: results.sarif

0 commit comments

Comments
 (0)