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

Merged
jwilger merged 2 commits from fix/release-pr-no-force-push into main 2026-06-12 23:24:11 -07:00
Owner

Problem

The Create/Update Release PR job fails on every run after the release PR is first created. Run #40 log:

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

release-plz update rebuilds the release branch off the latest main each run, so updating an open release PR took a git push --force-with-lease. The repo's * branch-protection rule blocks force-push (and deletion) on every branch, so the update path always fails once more PRs merge while a release PR is open.

Separately, the auto_review pre-merge PR metadata quality check rejected the bare chore: release title/body (no version, not descriptive).

Fix

  • No force-push. On update, open a fresh release branch and supersede the previous release PR (comment a pointer, then close it; the protected stale branch is left behind). A content diff skips the work when nothing changed, avoiding churn on unrelated pushes to main.
  • Metadata. Derive the lockstep version from [workspace.package], title the PR chore(release): vX.Y.Z, and build a descriptive body embedding the new changelog sections.
  • Guards. Phase 1 loop-prevention and Phase 2 publish guards updated from the chore: release prefix to chore(release):.

Merging this supersedes the stuck release PR #389 automatically.

## Problem The **Create/Update Release PR** job fails on every run after the release PR is first created. Run #40 log: ``` remote: Forgejo: branch release-plz-... is protected from force push ! [remote rejected] (pre-receive hook declined) ``` `release-plz update` rebuilds the release branch off the latest `main` each run, so updating an open release PR took a `git push --force-with-lease`. The repo's `*` branch-protection rule blocks force-push (and deletion) on every branch, so the update path always fails once more PRs merge while a release PR is open. Separately, the auto_review pre-merge **PR metadata quality** check rejected the bare `chore: release` title/body (no version, not descriptive). ## Fix - **No force-push.** On update, open a *fresh* release branch and supersede the previous release PR (comment a pointer, then close it; the protected stale branch is left behind). A content diff skips the work when nothing changed, avoiding churn on unrelated pushes to `main`. - **Metadata.** Derive the lockstep version from `[workspace.package]`, title the PR `chore(release): vX.Y.Z`, and build a descriptive body embedding the new changelog sections. - **Guards.** Phase 1 loop-prevention and Phase 2 publish guards updated from the `chore: release` prefix to `chore(release):`. Merging this supersedes the stuck release PR #389 automatically.
fix(release-plz): supersede release PR instead of force-pushing
All checks were successful
CI / Detect Changes (pull_request) Successful in 4s
CI / Request auto_review semantic review (pull_request) Successful in 2s
CI / Test (pull_request) Has been skipped
CI / Clippy (pull_request) Has been skipped
CI / Security Audit (pull_request) Has been skipped
auto_review auto_review: no findings
CI / Mutation (pull_request) Has been skipped
CI / Format (pull_request) Successful in 14s
CI / CI Gate (pull_request) Successful in 1s
bfa5408fad
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 that push is rejected by the pre-receive hook
and the "Create/Update Release PR" job fails on every update after the first
creation (e.g. run #40: "branch release-plz-... is protected from force push").

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 lockstep version from `[workspace.package]` and title the PR
`chore(release): vX.Y.Z` (conventional + versioned) with a body that explains
the release and embeds the new changelog sections. The Phase 1 loop-prevention
and Phase 2 publish guards are updated from the `chore: release` prefix to
`chore(release):` to match.
auto-review approved these changes 2026-06-12 23:19:37 -07:00
Dismissed
auto-review left a comment

It also improves PR metadata by including version information and changelog details. The changes appear safe to merge, with no major issues identified.

Walkthrough

  • Branch Management:

    • The script now creates a new release branch for each update, avoiding force-pushes that are blocked by branch protection rules.
    • It checks if the existing release PR is up-to-date before creating a new one, reducing unnecessary churn.
  • PR Metadata:

    • The PR title now includes the version number, improving clarity and compliance with conventional commit standards.
    • The PR body is more descriptive, detailing the changes and the purpose of the release.
  • Workflow Updates:

    • The publish.yml and release-plz.yml workflows have been updated to recognize the new commit message format (chore(release):).
  • Error Handling:

    • Consider adding error handling for awk, curl, and git commands to ensure robustness against failures.

LLM usage and cost

It also improves PR metadata by including version information and changelog details. The changes appear safe to merge, with no major issues identified. ## Walkthrough - **Branch Management**: - The script now creates a new release branch for each update, avoiding force-pushes that are blocked by branch protection rules. - It checks if the existing release PR is up-to-date before creating a new one, reducing unnecessary churn. - **PR Metadata**: - The PR title now includes the version number, improving clarity and compliance with conventional commit standards. - The PR body is more descriptive, detailing the changes and the purpose of the release. - **Workflow Updates**: - The `publish.yml` and `release-plz.yml` workflows have been updated to recognize the new commit message format (`chore(release):`). - **Error Handling**: - Consider adding error handling for `awk`, `curl`, and `git` commands to ensure robustness against failures. ## LLM usage and cost - Reasoning (gpt-4o) in=3566 out=649 cost=$0.027565 - Cheap (gpt-4o-mini) in=603 out=47 cost=$0.000119 Estimated total USD: $0.027684 via https://api.openai.com and https://api.openai.com
refactor(release-plz): generalize version/changelog extraction
All checks were successful
CI / Detect Changes (pull_request) Successful in 3s
CI / Request auto_review semantic review (pull_request) Successful in 2s
CI / Test (pull_request) Has been skipped
CI / Clippy (pull_request) Has been skipped
CI / Security Audit (pull_request) Has been skipped
auto_review auto_review: no findings
CI / Mutation (pull_request) Has been skipped
CI / Format (pull_request) Successful in 15s
CI / CI Gate (pull_request) Successful in 1s
e897e65b7f
Accept the release version from either `[workspace.package]` (workspaces) or
`[package]` (single-crate repos), and render a root-level CHANGELOG.md without
an empty `#### .` heading. This keeps the release-PR script identical across
the workspace (eventcore) and single-crate (emc) repositories.
jwilger dismissed auto-review's review 2026-06-12 23:21:35 -07:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

auto-review left a comment

The update to the release script now avoids force-pushing by creating a new branch for each release update, and improves PR metadata by deriving version information from the package manifest. The changes appear safe to merge.

Walkthrough

Δ since bfa5408:

  • Version Derivation:
    • The script now supports both workspace and single-crate repositories by checking for [workspace.package] and [package] sections.
  • Changelog Formatting:
    • Adjusted logic to handle cases where the crate is the root directory, affecting how changelog sections are formatted in the PR body.

LLM usage and cost

The update to the release script now avoids force-pushing by creating a new branch for each release update, and improves PR metadata by deriving version information from the package manifest. The changes appear safe to merge. ## Walkthrough ### Δ since bfa5408: - **Version Derivation:** - The script now supports both workspace and single-crate repositories by checking for `[workspace.package]` and `[package]` sections. - **Changelog Formatting:** - Adjusted logic to handle cases where the crate is the root directory, affecting how changelog sections are formatted in the PR body. ## LLM usage and cost - Reasoning (gpt-4o) in=1574 out=272 cost=$0.011950 - Cheap (gpt-4o-mini) in=603 out=50 cost=$0.000120 Estimated total USD: $0.012070 via https://api.openai.com and https://api.openai.com
jwilger deleted branch fix/release-pr-no-force-push 2026-06-12 23:24:11 -07:00
Sign in to join this conversation.
No description provided.