-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (75 loc) · 2.93 KB
/
scorecards.yml
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
name: Scorecards supply-chain security
on:
# Only the default branch is supported.
branch_protection_rule:
schedule:
- cron: '21 4 * * 5'
push:
branches: [ main ]
workflow_dispatch:
# Declare default permissions as read only.
permissions: read-all
jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
actions: read
contents: read
id-token: write # needed for keyless signing
steps:
- name: "Checkout code"
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
with:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@golang-staging # fork
with:
results_file: results.sarif
results_format: sarif
# Read-only PAT token. To create it,
# follow the steps in https://github.com/ossf/scorecard-action#pat-token-creation.
repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
# Publish the results to enable scorecard badges. For more details, see
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`,
# regardless of the value entered here.
publish_results: true
# Upload the results as artifacts (optional).
- name: "Upload artifact"
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
with:
name: Results
path: |
results.json
results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26
with:
sarif_file: results.sarif
# # Install Cosign and run on results.
# - name: Install Cosign
# uses: sigstore/cosign-installer@main #latest
# - name: Run Cosign
# env:
# COSIGN_EXPERIMENTAL: true
# run: |
# SOURCE_FILE=results.sarif
# COSIGN_OUTPUT_CERT=cosign_output/cosign-cert.pem
# COSIGN_OUTPUT_SIG=cosign_output/cosign-signature.sig
# cosign sign-blob --output-certificate $COSIGN_OUTPUT_CERT --output-signature $COSIGN_OUTPUT_SIG $SOURCE_FILE
# - name: "Upload cosign artifact"
# uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
# with:
# name: cosign data
# path: cosign_output
# retention-days: 5
# - name: "Verify cert"
# env:
# COSIGN_EXPERIMENTAL: true
# run: |
# cosign verify-blob --cert cosign_output/cosign-cert.pem --signature cosign_output/cosign-signature.sig results.sarif