Skip to content

Commit 3a6d970

Browse files
authored
ci: Implement OSSF Scorecard (#751)
1 parent a6712e3 commit 3a6d970

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.github/workflows/ossf-scorecard.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
# This workflow uses actions that are not certified by GitHub. They are provided by a third-party and are governed by separate terms of service, privacy policy, and support documentation.
3+
name: OSSF Scorecard
4+
on:
5+
# For Branch-Protection check. Only the default branch is supported. See https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection.
6+
branch_protection_rule:
7+
push:
8+
branches: [main]
9+
# To guarantee Maintained check is occasionally updated. See https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained.
10+
schedule:
11+
- cron: "0 0 * * 1"
12+
workflow_dispatch:
13+
# Declare default permissions as read only.
14+
permissions: read-all
15+
jobs:
16+
analysis:
17+
name: Scorecard analysis
18+
runs-on: ubuntu-24.04
19+
permissions:
20+
# Needed if using Code Scanning alerts
21+
security-events: write
22+
# Needed for GitHub OIDC token if publish_results is true
23+
id-token: write
24+
# Uncomment the permissions below if installing on a private repository.
25+
# contents: read
26+
# actions: read
27+
# issues: read # To allow GraphQL ListCommits to work
28+
# pull-requests: read # To allow GraphQL ListCommits to work
29+
# checks: read # To detect SAST tools
30+
steps:
31+
- name: Check out the codebase
32+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
33+
with:
34+
persist-credentials: false
35+
36+
- name: Run analysis
37+
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
38+
with:
39+
results_file: results.sarif
40+
results_format: sarif
41+
# (Optional) fine-grained personal access token. Uncomment the `repo_token` line below if:
42+
# - You want to enable the Branch-Protection check on a *public* repository.
43+
# - You are installing the OSSF Scorecard on a *private* repository.
44+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-fine-grained-pat-optional.
45+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
46+
47+
# Publish the results for public repositories to enable scorecard badges. For more details, see https://github.com/ossf/scorecard-action#publishing-results.
48+
# For private repositories, `publish_results` will automatically be set to `false`, regardless of the value entered here.
49+
publish_results: true
50+
51+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF format to the repository Actions tab.
52+
- name: Upload artifact
53+
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
54+
with:
55+
name: SARIF file
56+
path: results.sarif
57+
retention-days: 5
58+
59+
# Upload the results to GitHub's code scanning dashboard.
60+
- name: Upload SARIF results to code scanning
61+
uses: github/codeql-action/upload-sarif@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13
62+
with:
63+
sarif_file: results.sarif

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ CI/CD:
2525
- Switch GitHub Actions from using tags to release hashes.
2626
- Remove commented out Molecule platforms and GitHub Actions QEMU step for the time being. These changes will be reverted if multi-arch testing can be reinstated in GitHub Actions.
2727
- Remove platform metadata from the Ansible Galaxy role metadata since platforms are no longer supported in Ansible Galaxy NG.
28+
- Implement OSSF Scorecard.
2829

2930
## 0.24.3 (July 11, 2024)
3031

0 commit comments

Comments
 (0)