ci(deploy-prod): add the missing step that captures prod's pre-deploy SHA - #2364
Open
sajclarke wants to merge 1 commit into
Open
ci(deploy-prod): add the missing step that captures prod's pre-deploy SHA#2364sajclarke wants to merge 1 commit into
sajclarke wants to merge 1 commit into
Conversation
… SHA Deploy Production has failed at "Detect affected targets" on every run that didn't set deploy_all=true since #2165: ❌ Could not read the prod ref, so the affected base is unknown. #2165 replaced nx-set-shas with a base derived from the SHA prod was actually serving, wiring `setup`'s PROD_BEFORE to advance-prod's `previous-sha` output: previous-sha: ${{ steps.previous.outputs.sha }} but never added a step with `id: previous`. GitHub resolves an unknown `steps.<id>` expression to the empty string rather than erroring, so the output was always "" and the `[ -n "$PROD_BEFORE" ]` guard in `setup` fired every time. It went unnoticed because the only two prod deploys since #2165 (2026-08-04, 2026-08-18) both ran with deploy_all=true, which returns before that guard. Run 32409904357 (2026-08-20) was the first affected-detection prod deploy and failed. Add the capture step, before the fast-forward — once the ref moves the previous SHA is unrecoverable. Also gate release-notes on `setup`. It needs always() so a SKIPPED deploy job (the normal affected-detection outcome) still cuts the release, but with only advance-prod required it tagged a release for a run that deployed nothing: prod-2026-08-20-77e5ae2 exists for the failed run above. Note for the next release: run 32409904357's advance-prod succeeded, so the prod ref was fast-forwarded to 77e5ae2 while nothing shipped. Prod is still serving the 2026-08-18 deploy (35b86e6), so the first Deploy Production after this lands should use deploy_all=true to resync the ref with what is actually running. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
Amplify PR previews
Commit:
|
|
✅ I finished the code review, and didn't find any security or code quality issues. |
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.
The failure
Run 32409904357 — Deploy Production died at Detect affected targets:
Root cause
#2165 replaced
nx-set-shaswith an affected base derived from the SHA prod was actually serving. It wiredsetup'sPROD_BEFOREto anadvance-prodoutput:…but never added a step with
id: previous.advance-prodhas only the staging guard and the fast-forward. GitHub resolves an unknownsteps.<id>expression to the empty string rather than erroring, soprevious-shawas always""and the[ -n "$PROD_BEFORE" ]guard insetupfired on every run.It stayed hidden because the only two prod deploys since #2165 — 2026-08-04 and 2026-08-18 — both ran with
deploy_all=true, which returns early before that guard. 2026-08-20 was the first affected-detection prod deploy and it failed immediately. Latent since #2165, not a regression from anything recent.Changes
release-notesonsetup. It needsalways()so a skipped deploy job (the normal affected-detection outcome) still cuts a release, but with onlyadvance-prodrequired it tagged a release for a run that deployed nothing —prod-2026-08-20-77e5ae2exists for the failed run.The
setupguard itself was correct and did its job: it refused to under-deploy rather than silently shipping a partial release, which is exactly the failure mode #2165 was written to prevent. It just never had a producer.Run 32409904357's
advance-prodsucceeded — theprodref was fast-forwarded to77e5ae29while nothing was built or deployed. Amplify auto-build is off, so no app rebuilt, but the pointer now overstates what shipped.Prod is still serving the 2026-08-18 deploy (
35b86e6). Since the affected base now reads from the ref, a normal run would diff from77e5ae29and skip targets that changed between35b86e6and77e5ae29.The first Deploy Production after this lands should use
deploy_all=trueto resync the ref with what is actually running. Normal affected deploys are safe from then on.Verification
Workflow-only change; no application code touched.
advance-prodnow has three steps withid: previouspresent, sosteps.previous.outputs.sharesolves.uses:pins, so the exact-action-version-comment gate is unaffected.workflow_dispatchagainststaging.🤖 Generated with Claude Code