fix(release-plz): supersede release PR instead of force-pushing #115

Merged
jwilger merged 1 commit from fix/release-pr-no-force-push into main 2026-06-13 08:02:30 -07:00
Owner

Problem

Ported from Slipstream/eventcore (PR #395), which hit this in CI.

release-plz update rebuilds the release branch off the latest main each run, so updating an open release PR takes a git push --force-with-lease. The repo's * branch-protection rule blocks force-push (and deletion) on every branch, so once a release PR sits open while later commits land on main, the update push is rejected:

remote: Forgejo: branch release-plz-... is protected from force push
 ! [remote rejected] (pre-receive hook declined)

emc shares the identical script, so it has the same latent failure.

Fix

  • No force-push. On update, open a fresh release branch and supersede the previous release PR (comment a pointer, then close it). A content diff skips the work when nothing changed.
  • Metadata. Derive the version from [package], title the PR chore(release): vX.Y.Z, body embeds the new CHANGELOG section.

The script is now byte-identical to eventcore's canonical version. emc's release-plz workflow has no commit-message guards (jobs gate on repo + release-plz idempotency), so no workflow changes are needed here.

## Problem Ported from Slipstream/eventcore (PR #395), which hit this in CI. `release-plz update` rebuilds the release branch off the latest `main` each run, so updating an open release PR takes a `git push --force-with-lease`. The repo's `*` branch-protection rule blocks force-push (and deletion) on every branch, so once a release PR sits open while later commits land on `main`, the update push is rejected: ``` remote: Forgejo: branch release-plz-... is protected from force push ! [remote rejected] (pre-receive hook declined) ``` emc shares the identical script, so it has the same latent failure. ## Fix - **No force-push.** On update, open a *fresh* release branch and supersede the previous release PR (comment a pointer, then close it). A content diff skips the work when nothing changed. - **Metadata.** Derive the version from `[package]`, title the PR `chore(release): vX.Y.Z`, body embeds the new CHANGELOG section. The script is now byte-identical to eventcore's canonical version. emc's release-plz workflow has no commit-message guards (jobs gate on repo + release-plz idempotency), so no workflow changes are needed here.
fix(release-plz): supersede release PR instead of force-pushing
All checks were successful
CI / Nix flake check (pull_request) Successful in 5m57s
CI / Request auto_review semantic review (pull_request) Successful in 2s
auto_review auto_review: no findings
CI / Rust CI (pull_request) Successful in 11m40s
312e68d74a
release-plz rebuilds the release branch off the latest `main` on every run,
so updating an already-open release PR took a `git push --force-with-lease`
path. The repository's `*` branch-protection rule protects every branch from
force-push (and deletion), so once a release PR sits open while later commits
land on `main`, that push is rejected by the pre-receive hook and the release
PR job fails (the same failure already hit Slipstream/eventcore).

Instead of rewriting the protected branch, always open a fresh release branch
and supersede the previous release PR: open the new PR, comment a pointer on
the old one, and close it (its branch is left behind, since it cannot be
deleted). A content diff against the existing release branch skips the work
when nothing changed, avoiding PR churn on unrelated pushes to `main`.

Also make the release-PR metadata pass the auto_review pre-merge check: derive
the version from `[package]` and title the PR `chore(release): vX.Y.Z`
(conventional + versioned) with a body that explains the release and embeds
the new CHANGELOG section. The script is now byte-identical to eventcore's.
auto-review left a comment

The PR updates the release script to avoid force-pushing by creating a new release branch and superseding the existing PR. This change aligns the script with the eventcore's version and ensures compatibility with branch protection rules. The changes appear safe to merge.

Walkthrough

  • Version Derivation: The script now derives the release version from the Cargo.toml file, ensuring the PR title includes the version number.
  • Changelog Handling: It extracts the latest changelog section for inclusion in the PR body, providing context for the release.
  • Branch Management: Instead of force-pushing, a new branch is created for each release, and the existing PR is closed with a comment pointing to the new one.
  • PR Creation: The script constructs a detailed PR body explaining the release and listing changes, improving the clarity and traceability of releases.

LLM usage and cost

The PR updates the release script to avoid force-pushing by creating a new release branch and superseding the existing PR. This change aligns the script with the eventcore's version and ensures compatibility with branch protection rules. The changes appear safe to merge. ## Walkthrough - **Version Derivation**: The script now derives the release version from the `Cargo.toml` file, ensuring the PR title includes the version number. - **Changelog Handling**: It extracts the latest changelog section for inclusion in the PR body, providing context for the release. - **Branch Management**: Instead of force-pushing, a new branch is created for each release, and the existing PR is closed with a comment pointing to the new one. - **PR Creation**: The script constructs a detailed PR body explaining the release and listing changes, improving the clarity and traceability of releases. ## LLM usage and cost - Reasoning (gpt-4o) in=3165 out=376 cost=$0.021465 - Cheap (gpt-4o-mini) in=554 out=47 cost=$0.000111 Estimated total USD: $0.021576 via https://api.openai.com and https://api.openai.com
jwilger deleted branch fix/release-pr-no-force-push 2026-06-13 08:02:31 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Slipstream/emc!115
No description provided.