ci: stamp commit hash and message on Pages direct-upload deploy - #23
Merged
Merged
Conversation
wrangler pages deploy on a direct upload does not record the shipped commit unless told to, so the deploy-drift audit can report a repo as behind when the content is current (see MichalAFerber/audio-viewer.us#14). Adds --commit-hash and --commit-message, sourced from github.sha and the commit/PR-title event fields, passed through env vars and referenced with "$VAR" rather than interpolated into the run: text, since a commit message or PR title is attacker-influenceable. Same fix as MichalAFerber/audio-viewer.us#15, applied identically across the File Viewer family. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XE6Up1JPpFrhM5tC8hvHDE
tgwab-claude
enabled auto-merge (squash)
September 16, 2026 16:52
MichalAFerber
approved these changes
Sep 16, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
wrangler pages deployon a direct upload (Git integration is off for thisproject) does not record the shipped commit unless told to. Without
--commit-hash, CF Pages keeps reporting a stale or absent commit, and thedeploy-drift audit can flag production as "N commits behind" when the
served content is actually current.
Adds
--commit-hash "$COMMIT_HASH"and--commit-message "$COMMIT_MESSAGE"to the deploy step, sourced from
github.shaand the commit/PR-title eventfields via env vars and referenced as
"$VAR"in the shell script — notinterpolated directly into the
run:text, since a commit message or PRtitle is attacker-influenceable input and inline interpolation would be a
script-injection vector.
--branchwas already sourced this way for thebranch value; this PR moves it into the same env-var pattern for
consistency with the two new values.
Identical fix and identical diff shape to
MichalAFerber/audio-viewer.us#15,
the reference fix for
MichalAFerber/audio-viewer.us#14,
applied across the File Viewer family as part of the same sweep. Only
--project-namediffers between repos.What this does NOT do
Merging this does not retag the currently live deployment. Cloudflare
Pages does not retroactively stamp a commit hash onto a deployment that has
already shipped. The record corrects itself on this repo's next deploy to
main— until then, any deploy-drift read for this repo may still show theold, untagged commit.
Verified
npx wrangler@4 pages deploy --helpconfirms--commit-hashand--commit-messageare supported flags on the installed wrangler major(v4).
deploy.ymlmatches the reference repo's pre-fix shapeexactly (direct upload,
wrangler@4,--branchcomputed fromgithub.ref/github.head_ref,--commit-dirty=false, gated onCLOUDFLARE_API_TOKEN) — only--project-namediffers.python3 -c "import yaml; yaml.safe_load(...)").deploy step's
env:/run:block changed.Not verified
wrangler pages deployagainst production — out of boundsfor this sweep (no deploys).
repo (none has shipped yet with this fix).
🤖 Generated with Claude Code
https://claude.ai/code/session_01XE6Up1JPpFrhM5tC8hvHDE