-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add scorecards analysis workflow (#105)
- Loading branch information
Showing
6 changed files
with
115 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,19 +6,28 @@ | |
name: Pull Request | ||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
branches: [main, staging] | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
pr: | ||
permissions: | ||
pull-requests: read # for CondeNast/conventional-pull-request-action to get specific PR & list commits | ||
name: Lint PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: CondeNast/[email protected] | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 | ||
- uses: CondeNast/conventional-pull-request-action@eef02ae6e88e4b462f39931113b1a75cc275beee | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
|
@@ -34,9 +43,14 @@ jobs: | |
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python: ['3.9', '3.10'] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3.1.2 | ||
uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Install dependencies | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Scorecards supply-chain security | ||
on: | ||
# Only the default branch is supported. | ||
branch_protection_rule: | ||
schedule: | ||
- cron: 27 20 * * 1 | ||
push: | ||
branches: [main] | ||
|
||
# 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 | ||
actions: read | ||
contents: read | ||
|
||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Run analysis | ||
uses: ossf/scorecard-action@e7a29c14e6b337cf4310c70d1e9cd1565f0e9025 | ||
with: | ||
results_file: results.sarif | ||
results_format: sarif | ||
# Read-only PAT token. To create it, | ||
# follow the steps in https://github.com/ossf/scorecard-action#pat-token-creation. | ||
repo_token: ${{ secrets.SCORECARD_READ_TOKEN }} | ||
# Publish the results 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. | ||
publish_results: true | ||
|
||
# Upload the results as artifacts (optional). | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 | ||
with: | ||
name: SARIF file | ||
path: results.sarif | ||
|
||
# Upload the results to GitHub's code scanning dashboard. | ||
- name: Upload to code-scanning | ||
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 | ||
with: | ||
sarif_file: results.sarif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters