Files
Charles Lyding 7379d75782 ci: add permissions to current github action workflows (#45177)
The currently recommended best practice for Github action workflows is to set top-level permissions to read only. And if the job uses the automatic `GITHUB_TOKEN`, fine-grained permissions for each job based on the job's requirements should also be added.
All existing workflows in the repository now have top-level read only permission blocks.
Only the `scorecard` workflow currently requires additional job level permissions and the minimum set of permissions were already present for the job.

PR Close #45177
2022-02-24 21:39:38 +00:00

51 lines
1.3 KiB
YAML

name: OpenSSF Scorecard
on:
branch_protection_rule:
schedule:
- cron: '0 0 * * 0'
push:
branches: [master]
workflow_dispatch:
# Declare default permissions as read only.
permissions:
contents: read
jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
actions: read
contents: read
steps:
- name: 'Checkout code'
uses: actions/checkout@230611dbd0eb52da1e1f4f7bc8bb0c3a339fc8b7
with:
persist-credentials: false
- name: 'Run analysis'
uses: ossf/scorecard-action@3662744abc9b750123cb8965fef31e3802d52da5
with:
results_file: results.sarif
results_format: sarif
repo_token: ${{ secrets.GITHUB_TOKEN }}
publish_results: true
# Upload the results as artifacts.
- name: 'Upload artifact'
uses: actions/upload-artifact@2244c8200304ec9588bf9399eac622d9fadc28c4
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: 'Upload to code-scanning'
uses: github/codeql-action/upload-sarif@040feefecff4ae0fc15c110822a5f96516b0629e
with:
sarif_file: results.sarif