Skip to content

Commit d0971c6

Browse files
castrojoCopilot
andcommitted
fix(release): add promote_sha input for recovery promotion
Allows manually promoting a specific already-published SHA to stable when testing has advanced past it due to workflow-only commits. The SHA mismatch guard is bypassed when promote_sha is specified, since the caller is explicitly asserting which image to promote. Assisted-by: Claude Sonnet 4.6 via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0217325 commit d0971c6

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

.github/workflows/execute-release.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
description: 'Emergency recovery only — skip testsuite release gates'
1616
type: boolean
1717
default: false
18+
promote_sha:
19+
description: 'Recovery only — promote a specific SHA instead of the current testing HEAD (bypasses SHA mismatch guard)'
20+
required: false
21+
type: string
22+
default: ''
1823

1924
permissions:
2025
actions: read
@@ -51,8 +56,13 @@ jobs:
5156
exit 0
5257
fi
5358
54-
# Resolve the SHA that was built and published
55-
if [ "${{ github.event_name }}" = "workflow_run" ]; then
59+
# Resolve the SHA that was built and published.
60+
# promote_sha overrides SHA resolution (recovery: promotes a specific build
61+
# even when testing has advanced past it due to workflow-only commits).
62+
if [[ -n "${{ inputs.promote_sha }}" ]]; then
63+
BUILD_SHA="${{ inputs.promote_sha }}"
64+
echo "Recovery mode: promoting specified SHA ${BUILD_SHA}"
65+
elif [ "${{ github.event_name }}" = "workflow_run" ]; then
5666
BUILD_SHA="${{ github.event.workflow_run.head_sha }}"
5767
else
5868
BUILD_SHA=$(gh api "repos/${{ github.repository }}/git/ref/heads/testing" --jq '.object.sha')
@@ -77,7 +87,8 @@ jobs:
7787
7888
# Guard: if testing advanced since the build, the reusable fast-forward would
7989
# point main to a newer commit than the image we're promoting. Skip promotion.
80-
if [ "${{ github.event_name }}" = "workflow_run" ]; then
90+
# Bypassed when promote_sha is specified (recovery: explicit SHA override).
91+
if [ "${{ github.event_name }}" = "workflow_run" ] && [[ -z "${{ inputs.promote_sha }}" ]]; then
8192
CURRENT_SHA=$(gh api "repos/${{ github.repository }}/git/ref/heads/testing" --jq '.object.sha')
8293
if [ "$CURRENT_SHA" != "$BUILD_SHA" ]; then
8394
echo "::warning::testing has advanced (build: ${BUILD_SHA}, current: ${CURRENT_SHA}). Skipping promotion to avoid SHA mismatch on main fast-forward. Will promote next build."

0 commit comments

Comments
 (0)