Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 8 additions & 37 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
actions: read
checks: read
contents: read
id-token: write
issues: read
pull-requests: read
security-events: write
Expand All @@ -26,40 +27,12 @@ jobs:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Scorecard CLI
env:
SCORECARD_VERSION: "5.5.0"
SCORECARD_SHA256: "83b90a05c1540ef1390db1cd5711e5fd04be9c1d8537fb84d39d02092d6a8dff"
run: |
set -euo pipefail
archive="scorecard_${SCORECARD_VERSION}_linux_amd64.tar.gz"
curl -fsSLO "https://github.com/ossf/scorecard/releases/download/v${SCORECARD_VERSION}/${archive}"
echo "${SCORECARD_SHA256} ${archive}" | sha256sum -c -
mkdir -p "$RUNNER_TEMP/scorecard"
tar -xzf "${archive}" -C "$RUNNER_TEMP/scorecard" scorecard
chmod 0755 "$RUNNER_TEMP/scorecard/scorecard"
- name: Analyze
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
"$RUNNER_TEMP/scorecard/scorecard" \
--repo="github.com/${{ github.repository }}" \
--commit="${GITHUB_SHA}" \
--format=json \
--output="scorecard-results.json" \
--show-details
- name: Analyze SARIF
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
"$RUNNER_TEMP/scorecard/scorecard" \
--repo="github.com/${{ github.repository }}" \
--commit="${GITHUB_SHA}" \
--format=sarif \
--output="scorecard-results.sarif" \
--show-details
- name: Run Scorecard
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve dispatch runs on selected branches

Because this workflow still has workflow_dispatch, a maintainer can manually run it against a feature or release branch, but ossf/scorecard-action v2.4.3 rejects any non-PR event whose GITHUB_REF is not the repository default branch with only default branch is supported. The previous CLI path analyzed ${GITHUB_SHA} and produced/uploaded SARIF for those manual branch runs, so this replacement makes that advertised trigger fail before the SARIF and artifact upload steps; either restrict dispatch to the default branch or keep a non-default-branch path that does not use the action's default-branch validation.

Useful? React with 👍 / 👎.

with:
results_file: scorecard-results.sarif
results_format: sarif
publish_results: true
- name: Upload Scorecard SARIF
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
with:
Expand All @@ -68,7 +41,5 @@ jobs:
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: openssf-scorecard
path: |
scorecard-results.json
scorecard-results.sarif
path: scorecard-results.sarif
if-no-files-found: error
Loading