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

73 lines
2.9 KiB
YAML
Raw Normal View History

2022-10-07 18:22:49 +00:00
# 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.
name: Scorecard supply-chain security
2022-01-14 03:00:11 +00:00
on:
2022-10-07 14:25:58 +00:00
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
2021-12-10 17:49:59 +00:00
branch_protection_rule:
2022-10-07 14:25:58 +00:00
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
2021-12-10 17:49:59 +00:00
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: Scorecard analysis
2021-12-10 17:49:59 +00:00
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
2022-10-07 14:25:58 +00:00
# Needed to publish results and get a badge (see publish_results below).
2022-05-26 14:46:58 +00:00
id-token: write
2022-10-07 14:25:58 +00:00
# Uncomment the permissions below if installing in a private repository.
# contents: read
# actions: read
2022-09-23 18:04:56 -03:00
2021-12-10 17:49:59 +00:00
steps:
- name: "Checkout code"
2022-10-10 15:48:40 +00:00
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.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-10-27 13:22:19 +00:00
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
2021-12-10 17:49:59 +00:00
with:
results_file: results.sarif
results_format: sarif
2022-11-22 19:23:58 +00:00
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
2022-05-26 14:46:58 +00:00
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecard on a *private* repository
2022-05-26 14:46:58 +00:00
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
2022-11-22 19:23:58 +00:00
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
2022-05-26 14:46:58 +00:00
2022-10-07 14:25:58 +00:00
# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
2022-10-10 15:48:40 +00:00
# For private repositories:
2022-10-07 14:25:58 +00:00
# - `publish_results` will always 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-10-10 15:48:40 +00:00
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
2021-12-10 17:49:59 +00:00
with:
name: SARIF file
path: results.sarif
retention-days: 5
2022-09-23 18:04:56 -03:00
2021-12-10 17:49:59 +00:00
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
2022-10-10 15:48:40 +00:00
uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27
2021-12-10 17:49:59 +00:00
with:
sarif_file: results.sarif