Skip to content

Commit ee044f7

Browse files
authored
add openssf scorecard workflow and badge (#1416)
* add openssf scorecard workflow and badge Signed-off-by: Jordan Dubrick <[email protected]> * remove irrelevant info Signed-off-by: Jordan Dubrick <[email protected]> --------- Signed-off-by: Jordan Dubrick <[email protected]>
1 parent 7d9f8ac commit ee044f7

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

.github/workflows/scorecard.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Scorecard supply-chain security
2+
on:
3+
# For Branch-Protection check. Only the default branch is supported. See
4+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
5+
branch_protection_rule:
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
# Declare default permissions as read only.
10+
permissions: read-all
11+
12+
jobs:
13+
analysis:
14+
name: Scorecard analysis
15+
runs-on: ubuntu-latest
16+
permissions:
17+
# Needed to upload the results to code-scanning dashboard.
18+
security-events: write
19+
# Needed to publish results and get a badge (see publish_results below).
20+
id-token: write
21+
22+
steps:
23+
- name: "Checkout code"
24+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
25+
with:
26+
persist-credentials: false
27+
28+
- name: "Run analysis"
29+
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
30+
with:
31+
results_file: results.sarif
32+
results_format: sarif
33+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
34+
# - you want to enable the Branch-Protection check on a *public* repository, or
35+
# - you are installing Scorecard on a *private* repository
36+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
37+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
38+
39+
# Public repositories:
40+
# - Publish results to OpenSSF REST API for easy access by consumers
41+
# - Allows the repository to include the Scorecard badge.
42+
# - See https://github.com/ossf/scorecard-action#publishing-results.
43+
publish_results: true
44+
45+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
46+
# format to the repository Actions tab.
47+
- name: "Upload artifact"
48+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
49+
with:
50+
name: SARIF file
51+
path: results.sarif
52+
retention-days: 5
53+
54+
# Upload the results to GitHub's code scanning dashboard.
55+
- name: "Upload to code-scanning"
56+
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
57+
with:
58+
sarif_file: results.sarif

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Apache License](https://img.shields.io/badge/license-Apache-brightgreen.svg)](LICENSE)
66
[![Contribute](https://img.shields.io/badge/developer-workspace-525C86?logo=eclipse-che&labelColor=FDB940)](https://workspaces.openshift.com/f?url=https://github.com/devfile/api)
77
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8179/badge)](https://www.bestpractices.dev/projects/8179)
8-
8+
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/devfile/api/badge)](https://securityscorecards.dev/viewer/?uri=github.com/devfile/api)
99
</div>
1010

1111
Sources for this API are defined in Go code, starting from the

0 commit comments

Comments
 (0)