Skip to content

Backport: Reset the pull request body once the conflicts are resolved - #1548

Merged
sbrunner merged 1 commit into
masterfrom
backport-resolved-body
Nov 8, 2026
Merged

sbrunner merged 1 commit into
masterfrom
backport-resolved-body

Conversation

@sbrunner

@sbrunner sbrunner commented Nov 8, 2026

Copy link
Copy Markdown
Member

Summary

When a backport has conflicts, the backport pull request body contains the conflict resolution instructions and a BACKPORT_TODO file is committed to the branch. Once a contributor resolves the conflicts and removes the file, the body kept the stale instructions: the application refuses to overwrite a branch pushed by a human, so create_pull_request never regenerates it. The check action now resets the body once the backport is resolved.

Context

  • When the BACKPORT_TODO file is no more present in the backport branch (404 on the content fetch, on the opened, reopened and synchronize events of a ghci/backport/* or backport/* pull request), the body is rewritten to:

    Backport of #<source number> to <target branch>
    
    Conflicts resolved manually
    

Implementation Details

  • New _clean_backport_body() helper parsing the head branch name (ghci/backport/<number>-to-<branch>, legacy backport/ prefix also supported) to rebuild the clean message; the format is shared with _backport() through the new _backport_body() helper.
  • New _reset_resolved_body() method calling rest.pulls.async_update only when the body was generated by the application (it starts with the clean message and still contains the instructions). A customized body is never touched and the rewrite is idempotent (a clean backport or an already resolved body triggers no API call).

Impact/Risks

  • No configuration change, no breaking change: one extra API call on a resolved backport pull request, only while the body still contains the stale instructions.

@sbrunner sbrunner added the enhancement New feature or request label Nov 8, 2026
@sbrunner
sbrunner merged commit eef0487 into master Nov 8, 2026
15 checks passed
@sbrunner
sbrunner deleted the backport-resolved-body branch November 8, 2026 15:46

This branch was previously deployed

1 inactive deployment
publish — 494742fc Deployed Nov 8, 2026 by sbrunner via Publish #7360
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant