Skip to content

Commit baf0158

Browse files
fix(release): reuse only an OPEN promote PR, not one in any state
The promote step guarded PR creation with `gh pr view <branch>`, which resolves a pull request by head branch in any state. A closed one satisfied the guard, so creation was skipped while the step still exited 0 — a promotion that reports success and leaves nothing to merge, the same silent-skip shape as the enumeration bug fixed in #3404. STABLE_BRANCH is derived from the stable version, so every rc promoted to that version shares it. Both re-dispatch paths this workflow documents as supported are therefore wedged once any promote PR for that version has been closed: re-dispatching the same rc, and promoting a newer rc to the same version. Neither recovers by reopening the old PR, because the step's own force-push makes its head unreachable and GitHub refuses with "state cannot be changed. The <branch> branch was force-pushed or recreated." Hit live while promoting v1.6.0-rc.4 after #3397 had been closed: the run went green and opened no PR. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent d0c0f39 commit baf0158

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎.github/workflows/promote-rc.yaml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,18 @@ jobs:
259259
BASE="release-${LINE}"
260260
fi
261261
BODY="Promotes \`${RC_TAG}\` to stable \`${STABLE_TAG}\` — no rebuild. The tree pins the rc's images by digest. On merge, pull-requests-release.yaml creates the write-once \`${STABLE_TAG}\` tag at the merge commit, retags those digests to \`${STABLE_TAG}\` (+\`:latest\` when this is the newest stable), publishes the stable cozy-installer chart, and publishes the release — so the stable artifacts are bit-for-bit the rc that passed e2e. The \`full-e2e\` label forces the full suite on this PR. Do NOT squash-merge (decision B): the stable tag must attach to a real merge commit."
262-
if gh pr view "${STABLE_BRANCH}" >/dev/null 2>&1; then
262+
# Reuse an OPEN pr, create one otherwise. `gh pr view <branch>` was
263+
# wrong here: it resolves a pr by head branch in any state, so a
264+
# closed one satisfied the guard and creation was skipped while the
265+
# step still exited 0 — a promotion that reports success and leaves
266+
# nothing to merge. That wedges the two paths this workflow is built
267+
# to support, because STABLE_BRANCH is derived from the stable
268+
# version and is therefore shared by every rc promoted to it:
269+
# re-dispatching the same rc, and promoting a newer rc to the same
270+
# version. Neither can recover by reopening, since the force-push
271+
# below makes the old pr's head unreachable and GitHub then refuses
272+
# the reopen outright ("branch was force-pushed or recreated").
273+
if [ -n "$(gh pr list --head "${STABLE_BRANCH}" --state open --json number --jq '.[0].number')" ]; then
263274
echo "PR already open for ${STABLE_BRANCH}"
264275
else
265276
gh pr create --base "$BASE" --head "${STABLE_BRANCH}" \

0 commit comments

Comments
 (0)