Repository navigation
101 lines (92 loc) · 3.88 KB
/
Copy pathscorecard.yml
File metadata and controls
101 lines (92 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Scorecard
# Weekly OpenSSF Scorecard run. Publishes results to the Scorecard API and uploads
# SARIF to code scanning. Uses the official workflow shape with SHA-pinned actions.
# See SECURITY.md for checks that are intentionally not raised to 10.
on:
branch_protection_rule:
schedule:
# Weekly on Saturdays (Scorecard Maintained check).
- cron: "27 4 * * 6"
workflow_dispatch:
permissions: read-all
jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
# Checkout the repository.
contents: read
# Upload results to the code-scanning dashboard.
security-events: write
# Publish results and enable the Scorecard badge (OIDC).
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run analysis
uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0
with:
results_file: results.sarif
results_format: sarif
# Fine-grained PAT (Administration: Read-only) so Branch-Protection can read
# classic rules. Maintainer stores it as SCORECARD_TOKEN; see SECURITY.md.
# Fall back to github.token when SCORECARD_TOKEN is unset so an empty
# secret does not override the action default and break the run.
repo_token: ${{ secrets.SCORECARD_TOKEN || github.token }}
# Public repositories: publish to the OpenSSF API for consumers and the badge.
publish_results: true
- name: Upload artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: SARIF file
path: results.sarif
retention-days: 5
- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
sarif_file: results.sarif
- name: Run analysis for the floor gate
# Second pass of the same pinned action, in JSON, so the floor job can read every
# per-check score. The SARIF run above already published the results; this one does not.
uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0
with:
results_file: results.json
results_format: json
repo_token: ${{ secrets.SCORECARD_TOKEN || github.token }}
publish_results: false
- name: Upload the result for the floor gate
# Keep every step of this job to `uses:`. The Scorecard webapp rejects results from a
# workflow whose Scorecard job has a `run:` step, so the floor check lives in its own job.
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: scorecard-results-json
path: results.json
retention-days: 1
floor:
name: Check the scorecard floor
needs: analysis
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Download the result
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: scorecard-results-json
- uses: $/.github/actions/setup
with:
package-manager-cache: false
install: "false"
- name: Check scores against recorded targets
# Fails this run, naming each check, when a score is below its recorded target in
# tools/scorecard-floor.mjs. Targets only rise, never fall, without a written reason.
# Reads the downloaded result; no network access.
run: node tools/scorecard-floor.mjs results.json