Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backport GHA workflow #509

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tomleb
Copy link
Contributor

@tomleb tomleb commented Sep 18, 2024

Context

Backporting PRs to previous branch is pretty tedious. You have to:

  • git fetch
  • Checkout the target branch
  • Create a new backport branch
  • Find the commit hash of the merged PR
  • cherry-pick the commit
  • Fix or adjust the commit if necessary
  • git push
  • Go to the repository in your browser
  • Create a pull request
    • Usually the name of the branch will look something like [<branch>] <title of PR to backport>
    • Usually the description will be the same because the changes are the same. A backlink to the original PR is useful for reviewers so personally I add it whenever I think about it.
    • Usually I assign the same reviewers that were in the original PR
    • ^This is tedious

Summary

This PR is just an idea of a workflow that does all of this for us. The idea is you can just click on the Backport PR GHA workflow. Here's a screenshot of the workflow where the branch selected would be the target, the user must specify which PR number to backport and whether or not to cherry-pick the commit (the idea here is that we would still gain from everything even if we create an empty commit that can be edited).

image

Here's an example result from just running the script: #508.

Here's an example result from running in GHA: tomleb#11. Pretty much the same thing.

Note: I'd like some input from the team to know whether that's something they'd be interested in. I can totally run this script locally but if the whole team can benefit from it then why not.

Note: This could also be in the form of a github bot that reacts to comments, though that involves more work. (eg: Image just having to write /backport release/v0.4 in a merged PR.

Note: The script only supports squash commits. Now that squashed commits are enforced, this shouldn't be an issue in the future.

Possible improvements

  • Ability to assign it to the same people that reviewed the original PR automatically. Currently it's not done because the PR could fail to cherry-pick, though I could see it being useful if the cherry-pick succeeded.

@tomleb tomleb requested a review from a team as a code owner September 18, 2024 12:14
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