Skip to content

Commit 4547dd1

Browse files
committed
build: add OpenSSF Scorecard workflow
1 parent 8f30724 commit 4547dd1

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2023 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Workflow name:
20+
name: ossf_scorecard
21+
22+
# Workflow triggers:
23+
on:
24+
# For Branch-Protection check. Only the default branch is supported. See
25+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
26+
branch_protection_rule:
27+
# To guarantee Maintained check is occasionally updated. See
28+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
29+
schedule:
30+
- cron: '24 9 * * 0'
31+
32+
# Allow the workflow to be manually run:
33+
workflow_dispatch:
34+
35+
# Declare default global permissions as read only.
36+
permissions: read-all
37+
38+
# Workflow jobs:
39+
jobs:
40+
41+
# Define a job for running the scorecard analysis:
42+
analysis:
43+
44+
# Define a display name:
45+
name: Scorecard analysis
46+
47+
# Define the type of virtual host machine:
48+
runs-on: ubuntu-latest
49+
50+
# Workflow permissions:
51+
permissions:
52+
# Needed to upload the results to code-scanning dashboard.
53+
security-events: write
54+
# Needed to publish results and get a badge (see publish_results below).
55+
id-token: write
56+
57+
# Define the sequence of job steps...
58+
steps:
59+
# Checkout the repository:
60+
- name: 'Checkout repository'
61+
# Pin action to full length commit SHA
62+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
63+
timeout-minutes: 10
64+
with:
65+
persist-credentials: false
66+
67+
- name: "Run analysis"
68+
# Pin action to full length commit SHA
69+
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
70+
with:
71+
results_file: results.sarif
72+
results_format: sarif
73+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
74+
# - you want to enable the Branch-Protection check on a *public* repository, or
75+
# - you are installing Scorecard on a *private* repository
76+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
77+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
78+
79+
# Publishes results to OpenSSF REST API for easy access by consumers
80+
# Allows the repository to include the Scorecard badge.
81+
# See: https://github.com/ossf/scorecard-action#publishing-results.
82+
publish_results: true
83+
84+
# Upload the results as artifacts:
85+
- name: "Upload artifact"
86+
# Pin action to full length commit SHA
87+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
88+
with:
89+
name: SARIF file
90+
path: results.sarif
91+
retention-days: 5
92+
93+
# Upload the results to GitHub's code scanning dashboard:
94+
- name: "Upload to code-scanning"
95+
# Pin action to full length commit SHA
96+
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
97+
with:
98+
sarif_file: results.sarif

0 commit comments

Comments
 (0)