Skip to content

Commit f0fcade

Browse files
hyperpolymathclaude
andcommitted
ci(scorecards): mirror ephapax#264 — startup_failure + webapp 400
Two estate-wide failures that ephapax fixed today and boj-server still carries. Mirror the same fix to keep the sibling repos in sync. ### `scorecard.yml` — caller alignment Workflow was startup_failure-on-every-run because the caller diverged from `hyperpolymath/standards`'s `scorecard-reusable.yml` documented caller example in 4 ways: - missing `concurrency:` group (re-pushes piled up superseded runs) - `branch_protection_rule:` trigger present (unused; complicates startup) - `secrets: inherit` against a reusable with no `secrets:` block - `permissions: read-all` instead of explicit `contents: read` Now matches the reusable's header example verbatim. SHA pin unchanged (`e0caf11508a3989574713c78f5f444f2ce5e33ef`). ### `scorecard-enforcer.yml` — two-job split Score itself was succeeding (~5.5 typical), but the OSSF Scorecard webapp HTTP-400'd the signed-result POST whenever the `scorecard` job contained a `run:` step (per https://github.com/ossf/scorecard-action#workflow-restrictions — "scorecard job must only have steps with `uses`"). The webapp's workflow verifier rejects mixed-shape jobs when `publish_results: true` triggers the signed-publish path. Split into: - `scorecard` (uses-only): runs scorecard-action with publish, uploads SARIF, saves results.sarif as an artifact for Job 2. - `enforce-min-score` (needs: scorecard): downloads the artifact and runs the bash min-score gate. `run:` steps are fine here because this job does not call scorecard-action. Action SHA pins verified via `gh api repos/<org>/<action>/commits/<sha>` (`actions/upload-artifact@4cec3d8` + `actions/download-artifact@cc20338`). Refs hyperpolymath/ephapax#264 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0724af5 commit f0fcade

2 files changed

Lines changed: 66 additions & 8 deletions

File tree

.github/workflows/scorecard-enforcer.yml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# SPDX-License-Identifier: MPL-2.0
2-
# Prevention workflow - runs OpenSSF Scorecard and fails on low scores
2+
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
#
4+
# Prevention workflow - runs OpenSSF Scorecard and fails on low scores.
5+
#
6+
# Split into TWO jobs to satisfy the OSSF Scorecard webapp's workflow
7+
# restriction:
8+
# "scorecard job must only have steps with `uses`"
9+
# (https://github.com/ossf/scorecard-action#workflow-restrictions).
10+
#
11+
# When the publishing job contains a `run:` step, the webapp rejects
12+
# the signed-result POST with HTTP 400 "workflow verification failed".
13+
# That regression had this workflow `failure`-state ever since
14+
# `publish_results: true` was added — the score *was* computed, but
15+
# the webapp publish step failed and propagated to job-level failure.
16+
#
17+
# Job 1 (`scorecard`): uses-only steps. Computes the score, publishes
18+
# signed results to the OSSF webapp, uploads SARIF to GitHub code
19+
# scanning, and saves results.sarif as an artifact for Job 2.
20+
#
21+
# Job 2 (`enforce-min-score`): downloads the artifact and runs the
22+
# minimum-score gate. May contain `run:` steps freely — it does not
23+
# call scorecard-action.
24+
#
25+
# Sister fix landed in hyperpolymath/ephapax#264 (2026-06-01); this
26+
# PR mirrors it so the two repos stay in sync.
27+
328
name: OpenSSF Scorecard Enforcer
429

530
on:
@@ -43,14 +68,30 @@ jobs:
4368
with:
4469
sarif_file: results.sarif
4570

71+
- name: Upload results artifact for min-score gate
72+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
73+
with:
74+
name: scorecard-results
75+
path: results.sarif
76+
retention-days: 7
77+
78+
enforce-min-score:
79+
needs: scorecard
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Download results artifact
83+
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
84+
with:
85+
name: scorecard-results
86+
4687
- name: Check minimum score
4788
run: |
48-
# Parse score from results
89+
# Parse score from SARIF results.
4990
SCORE=$(jq -r '.runs[0].tool.driver.properties.score // 0' results.sarif 2>/dev/null || echo "0")
5091
5192
echo "OpenSSF Scorecard Score: $SCORE"
5293
53-
# Minimum acceptable score (0-10 scale)
94+
# Minimum acceptable score (0-10 scale).
5495
MIN_SCORE=5
5596
5697
if [ "$(echo "$SCORE < $MIN_SCORE" | bc -l)" = "1" ]; then

.github/workflows/scorecard.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
11
# SPDX-License-Identifier: MPL-2.0
2+
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
#
4+
# Aligned with the documented caller pattern in
5+
# hyperpolymath/standards .github/workflows/scorecard-reusable.yml.
6+
# Previously this workflow was startup_failure-on-every-run because it
7+
# diverged from the reusable's documented caller shape:
8+
# - missing `concurrency:` group (re-pushes piled up superseded runs)
9+
# - `branch_protection_rule:` trigger (unused; complicates startup)
10+
# - `secrets: inherit` against a reusable with no `secrets:` block
11+
# - `permissions: read-all` instead of explicit `contents: read`
12+
# Pattern now matches the reusable's header example verbatim. Sister
13+
# fix landed in hyperpolymath/ephapax#264 (2026-06-01); this PR mirrors
14+
# it so the two repos stay in sync.
215
name: Scorecards supply-chain security
316

417
on:
5-
branch_protection_rule:
6-
schedule:
7-
- cron: '23 4 * * 1'
818
push:
919
branches: [main]
20+
schedule:
21+
- cron: '23 4 * * 1'
22+
workflow_dispatch:
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.ref }}
26+
cancel-in-progress: true
1027

11-
permissions: read-all
28+
permissions:
29+
contents: read
1230

1331
jobs:
1432
analysis:
1533
permissions:
1634
security-events: write
1735
id-token: write
1836
uses: hyperpolymath/standards/.github/workflows/scorecard-reusable.yml@e0caf11508a3989574713c78f5f444f2ce5e33ef
19-
secrets: inherit

0 commit comments

Comments
 (0)