Skip to content

Commit 17b2206

Browse files
theCodeDriftclaude
andcommitted
fix(ci): pin the breadcrumb job's checkout to the validated commit
#133 and #132 crossed. The nightly moved to `workflow_run` in #132, where every checkout must carry `ref: github.event.workflow_run.head_sha`; the `breadcrumb` job added by #133 was written against the `push` trigger and merged without it. Under `workflow_run` that is not an error. `github.sha` is the default branch tip at event time, so the job checks out whatever `main` had moved to and succeeds — running a copy of nightly-breadcrumb.cjs that Validate never saw, while announcing a nightly built from a different commit. An empty `ref:` fails the same way, silently, which is why the other two jobs assert HEAD rather than trusting the checkout. Cosmetic output does not lower the bar: it is the same fail-open shape, and it reads as a normal green run. The job now pins the ref and asserts HEAD against it, matching gate and publish line for line. Nothing else moves. `breadcrumb` still reaches gate 0 transitively — a skipped `gate` skips `publish`, which skips this — so it restates none of those four conditions, and it consumes the publish job's stamped version rather than re-deriving a short sha. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jwc9FFroR3mTZ4hLiSkkX3
1 parent f9f05c0 commit 17b2206

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎.github/workflows/release-cli-nightly.yml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,35 @@ jobs:
624624
contents: read # checkout only — the script lives in this repo
625625
pull-requests: write # the one capability this job exists to use
626626
steps:
627+
# `ref:` is MANDATORY under workflow_run here too, for the same reason it
628+
# is on the other two jobs: without it checkout takes `github.sha`, the
629+
# default branch tip at event time, and this job would run a COPY OF THE
630+
# SCRIPT that is not the one Validate passed on — while announcing a
631+
# nightly built from a different commit. Cosmetic output does not lower
632+
# the bar; it is the same fail-open, and it reads as a normal run.
627633
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
628634
with:
635+
ref: ${{ github.event.workflow_run.head_sha }}
629636
persist-credentials: false # gh authenticates with GITHUB_TOKEN below
637+
- name: Confirm the checkout is the commit Validate passed on
638+
env:
639+
VALIDATED_SHA: ${{ github.event.workflow_run.head_sha }}
640+
run: |
641+
set -euo pipefail
642+
643+
# An empty `ref:` is not an error to actions/checkout — it falls back
644+
# to the default branch and succeeds. Absent must not read as fine.
645+
if [ -z "$VALIDATED_SHA" ]; then
646+
echo "::error::The workflow_run payload carried no head_sha; refusing to annotate from an unidentified commit."
647+
exit 1
648+
fi
649+
650+
actual=$(git rev-parse HEAD)
651+
if [ "$actual" != "$VALIDATED_SHA" ]; then
652+
echo "::error::Checked out ${actual} but Validate passed on ${VALIDATED_SHA}; refusing to annotate with a script from an unvalidated commit."
653+
exit 1
654+
fi
655+
echo "Annotating from ${actual}, which Validate passed on."
630656
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
631657
with:
632658
node-version: 24

0 commit comments

Comments
 (0)