Files
starter-workflows/code-scanning/scorecards.yml
T

63 lines
2.3 KiB
YAML
Raw Normal View History

2021-12-10 17:49:59 +00:00
name: Scorecards supply-chain security
2022-01-14 03:00:11 +00:00
on:
2021-12-10 17:49:59 +00:00
# Only the default branch is supported.
branch_protection_rule:
schedule:
2021-12-16 18:25:53 +00:00
- cron: $cron-weekly
2021-12-10 17:49:59 +00:00
push:
branches: [ $default-branch ]
# 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
2022-05-26 14:46:58 +00:00
# Used to receive a badge. (Upcoming feature)
id-token: write
2022-06-01 11:00:27 -07:00
# Needs for private repositories.
2022-01-10 23:19:46 +00:00
contents: read
2022-06-01 11:00:27 -07:00
actions: read
2022-05-26 14:46:58 +00:00
2021-12-10 17:49:59 +00:00
steps:
- name: "Checkout code"
2022-05-26 14:50:13 +00:00
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
2021-12-28 17:49:56 +00:00
with:
persist-credentials: false
2021-12-10 17:49:59 +00:00
- name: "Run analysis"
2022-06-01 09:15:10 -07:00
uses: ossf/scorecard-action@3e15ea8318eee9b333819ec77a36aca8d39df13e # v1.1.1
2021-12-10 17:49:59 +00:00
with:
results_file: results.sarif
results_format: sarif
2022-05-26 14:46:58 +00:00
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecards on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
# Publish the results for public repositories 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.
2021-12-10 17:49:59 +00:00
publish_results: true
2022-05-26 14:46:58 +00:00
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
2021-12-10 17:49:59 +00:00
- name: "Upload artifact"
2022-05-26 14:50:13 +00:00
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
2021-12-10 17:49:59 +00:00
with:
name: SARIF file
path: results.sarif
retention-days: 5
2022-05-26 14:46:58 +00:00
2021-12-10 17:49:59 +00:00
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
2021-12-28 17:49:56 +00:00
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26
2021-12-10 17:49:59 +00:00
with:
sarif_file: results.sarif