Automating backporting on comment
It will be nice to be able be able to ask pytestbot to backport a PR to a target branch, right now it's a bit tedious.
I've started an attempt here: https://github.com/bluetech/pytest/commits/backport-on-comment It completely rips off @nicoddemus's work on release-on-comment and adapts it to backporting.
I'm too lazy ATM to actually set up all the necessary bits for testing it without actually merging to pytest master, so just throwing it here. I'd be very surprised if it works at first try.
Why a comment rather than a "needs backport" label? Would be nice IMHO if the backport was done automatically if there was such a label, and then the label gets removed (if the bot was able to open a PR without conflicts).
Also makes me wonder if we can reuse what CPython does: https://github.com/python/miss-islington
Why a comment rather than a "needs backport" label?
I don't have a preference really, it was easier to copy from release-on-comment but can probably be changed if we prefer to do it with labels.
Also makes me wonder if we can reuse what CPython does: https://github.com/python/miss-islington
This needs a server, if I understand correctly.
I suppose we could also use an existing GitHub Action, such as ~~https://github.com/Gaurav0/backport~~ (requires to make your API token public, wut...) https://github.com/tibdex/backport
Thanks for tackling this @bluetech! This is something I had in the back of my mind for a good time now but didn't find the time to work on.
I suppose we could also use an existing GitHub Action, such as Gaurav0/backport (requires to make your API token public, wut...) tibdex/backport
Cool! I was planning to investigate this a bit before going with a custom implementation, thanks for finding it.
https://github.com/tibdex/backport seems like a good fit, although it doesn't seem to require a public API token, it uses a secret, so it seems it would work with our existing token even.
@bluetech would you like to give this a spin if you have the time?
https://github.com/tibdex/backport seems like a good fit, although it doesn't seem to require a public API token, it uses a secret, so it seems it would work with our existing token even.
To clarify: The Gaurav0 fork which I linked initially requires making your API token public - I first thought it improved some things compared to the original tibdex action, but that clearly is a no-go. The tibdex one seems fine.
Isn't it preferable to have something we can adjust ourselves? Looking at the code of the tibdex action https://github.com/tibdex/backport/blob/master/src/backport.ts there isn't any magic there, it does about the same as the python script, but in javascript...
Also I noticed the code says
However, Backport only supports rebased and merged pull requests with a single commit and squashed and merged pull requests
I think it means it doesn't support merged PRs with multiple commits which is our usual merging method.
Can this be closed? It seems this is superseeded by label-based backporting #9405.
Thanks @timhoffm