From f9a9e797fd680574b3e78b546b19643fe9ad7955 Mon Sep 17 00:00:00 2001 From: mignot Date: Tue, 1 Dec 2026 19:34:15 +0100 Subject: [PATCH] fix(release-please): retry a transient release-please failure before arming auto-merge A single failed release-please-action run (empty error, GitHub API) left the release PR open and unarmed, and nothing re-triggers the workflow. Retry once after a pause; arm auto-merge only after a successful run. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/release-please.yml | 17 ++++++++++++++++- README.md | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 03b5e17..78434ab 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -101,7 +101,21 @@ jobs: run: | mapfile -t policies < <(grep '[^[:space:]]' <<< "$POLICIES" | sed -E 's/^[[:space:]]+|[[:space:]]+$//g') python3 ../foundation/release/reconcile-release-prs.py "${policies[@]}" + # release-please recomputes everything from the main HEAD and updates the open release PR, so a transient + # API failure is retried once instead of stranding the release PR (nothing else re-triggers this workflow). - id: release + continue-on-error: true + uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + with: + token: ${{ steps.app.outputs.token }} + config-file: ${{ inputs.config-file }} + manifest-file: ${{ inputs.manifest-file }} + skip-github-release: true + - name: Wait before retrying release-please + if: steps.release.outcome == 'failure' + run: sleep 20 + - id: release-retry + if: steps.release.outcome == 'failure' uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 with: token: ${{ steps.app.outputs.token }} @@ -109,10 +123,11 @@ jobs: manifest-file: ${{ inputs.manifest-file }} skip-github-release: true # Re-armed on every run: pushing to a release PR disarms auto-merge, and the head is pinned. + # Skipped when both attempts fail: arming after a partial release-please update could publish unchecked content. - name: Arm auto-merge on release PRs if: inputs.auto-merge working-directory: caller env: RELEASE_PR_APP_TOKEN: ${{ steps.app.outputs.token }} - RELEASE_PRS: ${{ steps.release.outputs.prs }} + RELEASE_PRS: ${{ steps.release.outcome == 'success' && steps.release.outputs.prs || steps.release-retry.outputs.prs }} run: python3 ../foundation/release/arm-release-pr-auto-merge.py diff --git a/README.md b/README.md index e34eea0..5dbbdc2 100644 --- a/README.md +++ b/README.md @@ -732,4 +732,4 @@ Release-please is the only way to prepare releases in an adopting repository: `. ### Auto-merging release PRs -With `auto-merge: true`, `release-please.yml` arms squash auto-merge on every open release PR (label `autorelease: pending`) through [`release/arm-release-pr-auto-merge.py`](release/arm-release-pr-auto-merge.py): the commit title is the PR title and the head commit is pinned, so a later push disarms it until the next run re-arms it. The release PR then merges as soon as the required checks pass, and the release is tagged and published **without human review**. Prerequisites in the adopting repository: `allow_auto_merge`, no required review, squash merges with `PR_TITLE` as the commit title, and the `pr-title` check required (all enforced by `github-config` for repositories with `release_pr: true`). Activate `auto-merge` only after those are in place. The PRs reported by `release-please-action` are armed as well, because the label listing can lag behind a PR opened seconds earlier. Only PRs from a `release-please--*` branch of the repository itself are armed, whatever their labels. A PR that GitHub refuses to arm and whose REST merge state (`mergeable_state`, re-read up to five times while it is `unknown`) is `clean` is squash merged directly with the same title and the pinned head: the branch rules still apply, and no later run would arm it. \ No newline at end of file +With `auto-merge: true`, `release-please.yml` arms squash auto-merge on every open release PR (label `autorelease: pending`) through [`release/arm-release-pr-auto-merge.py`](release/arm-release-pr-auto-merge.py): the commit title is the PR title and the head commit is pinned, so a later push disarms it until the next run re-arms it. The release PR then merges as soon as the required checks pass, and the release is tagged and published **without human review**. Prerequisites in the adopting repository: `allow_auto_merge`, no required review, squash merges with `PR_TITLE` as the commit title, and the `pr-title` check required (all enforced by `github-config` for repositories with `release_pr: true`). Activate `auto-merge` only after those are in place. The PRs reported by `release-please-action` are armed as well, because the label listing can lag behind a PR opened seconds earlier. Only PRs from a `release-please--*` branch of the repository itself are armed, whatever their labels. A PR that GitHub refuses to arm and whose REST merge state (`mergeable_state`, re-read up to five times while it is `unknown`) is `clean` is squash merged directly with the same title and the pinned head: the branch rules still apply, and no later run would arm it. `release-please-action` is run a second time after a 20 s pause when its first run fails (it recomputes from the `main` HEAD and updates the open release PR, so it is safe to repeat): a transient GitHub API error no longer strands the release PR, which nothing else would re-trigger. Arming happens only after a successful run; when both runs fail the job fails and nothing is armed, because a partial update could leave the PR title (the squash commit and tag) out of step with its branch. \ No newline at end of file