-
Notifications
You must be signed in to change notification settings - Fork 377
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 a backport GitHub Actions workflow #3519
Conversation
Now that we have release branches such as 0.1, we would like some convenient way to backport certain PRs that target `main`. This workflow was adapted from the one in the NixOS/nixpkgs repo and works as follows: To attempt to automatically create a PR that backports a PR merged to main, add the `backport X.Y` label to the merged PR where `X.Y` is an existing release branch (e.g `backport 0.1`). If the action is able to cherry-pick all the commits of the merged PR into a new PR targeting the `X.Y` branch, then the backport PR will be created. Otherwise, the GitHub Actions bot will reply to the merged PR indicating that there were merge conflicts and that you will manually need to backport by cherry-picking and resolving those conflicts.
7765a94
to
1bcfca4
Compare
Okay, should be good to go. |
jobs: | ||
backport: | ||
name: Backport Pull Request | ||
if: github.repository_owner == 'lightningdevkit' && github.event.pull_request.merged == true && (github.event_name != 'labeled' || startsWith('backport', github.event.label.name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait when exactly will this run? It looks like it requires github.event.pull_request.merged
which implies it'll only actually run on merges?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested that it runs once labelling a merged pull request.
|
||
permissions: | ||
pull-requests: write | ||
contents: write |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, why do people have to build things based on actions and not based on bots...I wonder if this isn't easier to do by just having a bot with its own github user run in python and hit the github API...
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Create backport PRs | ||
uses: korthout/backport-action@be567af183754f6a5d831ae90f648954763f17f5 # v3.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grrr, this is a pile of typescript...I find typescript fairly hard to review, let alone typescript garbage that has dependencies on basic shit like "build a string".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think we could find something or put something together based on a bot that hits the GH API. Manually cherry picking for now should be not too terrible.
Working on a simple bot with a GitHub user account. Then you'd just need to set up one webhook in the repo settings for trigger on label with a secret (to avoid spam) to hit an endpoint of the bot. That should be much better than this. |
Now that we have release branches such as 0.1, we would like some convenient way to backport certain PRs that target
main
.This workflow was adapted from the one in the NixOS/nixpkgs repo and works as follows:
To attempt to automatically create a PR that backports a PR merged to main, add the
backport X.Y
label to the merged PR whereX.Y
is an existing release branch (e.gbackport 0.1
). If the action is able to cherry-pick all the commits of the merged PR into a new PR targeting theX.Y
branch, then the backport PR will be created. Otherwise, the GitHub Actions bot will reply to the merged PR indicating that there were merge conflicts and that you will manually need to backport by cherry-picking and resolving those conflicts.NOTE: For this action to work we must allow GitHub Actions to create pull requests. This checkbox can be found in settings at Actions > General > Workflow permissions.