Skip to content

ci(release-plz): prune stale release branches before opening the PR#9

Merged
AprilNEA merged 1 commit into
masterfrom
ci/release-plz-prune-stale-branches
May 31, 2026
Merged

ci(release-plz): prune stale release branches before opening the PR#9
AprilNEA merged 1 commit into
masterfrom
ci/release-plz-prune-stale-branches

Conversation

@AprilNEA
Copy link
Copy Markdown
Owner

Problem

release-plz release-pr has been failing with HTTP 422 and the job swallows it as a warning (release-plz release-pr failed with HTTP 422; continuing with no PRs created{"prs":[]}), so no release PR is created and releases silently stopped (latest tag is still v0.1.2 despite merged feat/fix commits).

Root cause: a leftover release-plz-2026-05-30T18-10-22Z branch from the merged v0.1.1 release PR (#3) — release-plz collides with the stale ref when creating the next release branch/PR.

Fix

Add a prune step to the release-pr job (after minting the GitHub App token, before release-plz release-pr): delete any release-plz-* branch that has no open PR, keeping the active release PR's branch untouched. The pipeline now self-heals instead of needing a manual branch deletion.

Merging this to master re-triggers release-plz with the prune step, which should clear the stale branch and finally open the pending release PR.

Note

The pending release will be computed by release-plz from conventional commits — with the feat(gui) commits since 0.1.2 that's a 0.2.0 (minor) bump, not 0.1.3. Version decision to be made on the release PR it opens.

release-plz leaves its `release-plz-*` branch behind after a release PR is
merged; the leftover ref makes the next `release-pr` fail with HTTP 422 (the
job swallows it as a warning, so no release PR is ever created and releases
silently stop). Before running release-pr, delete any `release-plz-*` branch
that has no open PR — keeping the active release PR's branch untouched — so the
pipeline self-heals instead of needing a manual branch deletion each time.
Copy link
Copy Markdown

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — a one-step prune of stale release-plz-* branches added to the release-pr job so a leftover ref from a merged release PR can't keep release-plz failing with HTTP 422.

  • Prune step before release-plz release-pr — iterates every release-plz-* branch returned by gh api repos/$REPO/branches --paginate, deletes any without an open PR, and downgrades DELETE failures to ::warning::. The active release PR's branch is preserved by the open-PR guard.

ℹ️ The swallowed HTTP 422 is the deeper failure mode

This PR fixes the specific 422 trigger (stale branch) but the underlying reason releases stopped silently is that the release-plz action treats release-pr HTTP 422 as a warning and returns {"prs":[]}. The next time a different glitch produces a 422 (or any other non-fatal-to-the-action error path), releases will silently stall again and the symptom will look identical to a quiet week of commits.

Worth a follow-up — e.g. a post-step that fails the job if the action reported no PR created and there are unreleased conventional commits on master. Out of scope for this PR; flagging so it doesn't get lost.

ℹ️ Hardcoded release-plz- prefix vs. configurable pr_branch_prefix

release-plz.toml does not currently set pr_branch_prefix, so the default release-plz- prefix matches the grep here. If that ever gets customized, the prune step will silently skip branches and the original failure mode returns. Not worth fixing today — just worth a note next to the grep, or a comment in release-plz.toml reminding future-you to update the workflow grep if you change the prefix.

Pullfrog  | View workflow run | Using Claude Opus𝕏

@AprilNEA AprilNEA merged commit 03b5591 into master May 31, 2026
6 checks passed
@AprilNEA AprilNEA deleted the ci/release-plz-prune-stale-branches branch May 31, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant