Repository navigation
Backport: Reset the pull request body once the conflicts are resolved - #1548
Merged
Merged
Conversation
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a backport has conflicts, the backport pull request body contains the conflict resolution instructions and a
BACKPORT_TODOfile 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, socreate_pull_requestnever regenerates it. Thecheckaction now resets the body once the backport is resolved.Context
When the
BACKPORT_TODOfile is no more present in the backport branch (404on the content fetch, on theopened,reopenedandsynchronizeevents of aghci/backport/*orbackport/*pull request), the body is rewritten to:Implementation Details
_clean_backport_body()helper parsing the head branch name (ghci/backport/<number>-to-<branch>, legacybackport/prefix also supported) to rebuild the clean message; the format is shared with_backport()through the new_backport_body()helper._reset_resolved_body()method callingrest.pulls.async_updateonly 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