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

backport-main label does not auto backport #123

Open
pllim opened this issue May 6, 2024 · 12 comments
Open

backport-main label does not auto backport #123

pllim opened this issue May 6, 2024 · 12 comments

Comments

@pllim
Copy link
Contributor

pllim commented May 6, 2024

Hello and thanks for this very useful bot. We have a workflow where we forward-port change log from a release branch back to main at release time. Hence, we created a backport-main label (see https://github.com/astropy/astropy/labels) with the auto backport directive. However, the auto backport does not work, though the manual comment does. Example:

cc @astrofrog

@Carreau
Copy link
Contributor

Carreau commented May 7, 2024

Hum, I only have 48 hours of logs, so can't look at it after the fact. Sorry about that, I'll try to experiment on test-repo.

@astrofrog
Copy link

astrofrog commented Jul 25, 2024

@Carreau it has just happened again today in case you are able to spot it in the logs (for astropy)

@pllim
Copy link
Contributor Author

pllim commented Jul 25, 2024

He did say the logs only go for 48 hours and your issue is 2 days old, so unlikely.

@astrofrog
Copy link

Hmm yes sorry misremembered, time flies!

@Carreau
Copy link
Contributor

Carreau commented Jul 29, 2024

Sorry, I was on time-off and did not check github for a few days.

@astrofrog
Copy link

astrofrog commented Aug 30, 2024

Just a heads-up that I will soon be merging a PR labelled backport-main: astropy/astropy#16911 (in a few hours)

@astrofrog
Copy link

I just merged the PR at 11:58 GMT

@astrofrog
Copy link

astrofrog commented Aug 30, 2024

Requested a manual backport at 12:52 GMT (this succeeded)

@pllim
Copy link
Contributor Author

pllim commented Aug 30, 2024

So I think 2 things need addressing for this label to work properly.

  1. backport-main should automatically open a PR to main when it detects merge event from a PR that is not opened against main.
  2. On a PR with backport-main label that is opened against main (currently possible via the bot via comment backport to main), it should not try to backport that backport PR to main again on merge. Currently it does and then post an error message comment, unless I remove backport-main label before merge.

@astrofrog
Copy link

I wonder if the issue here is that the PR for which we want backport-main to work is not merged into main but into a release branch - perhaps the bot only watches for PRs opened again main?

@Carreau
Copy link
Contributor

Carreau commented Sep 2, 2024

I wonder if the issue here is that the PR for which we want backport-main to work is not merged into main but into a release branch - perhaps the bot only watches for PRs opened again main?

It is quite possible, otherwise as the backported PRs get the same labels applied than the original one, merging a backport would trigger an infinite loop.

There is likely a smarter way to do that, but I did not look into it.

@pllim
Copy link
Contributor Author

pllim commented Sep 3, 2024

Maybe the logic here (or around here)

if "on-merge:" in description_str and is_pr["base"]["ref"] in (
"master",
"main",
):

can be generalized to something like

  1. Grab the base ref branch no matter what.
  2. Check for target branch in label description.
  3. If base ref same as target, no-op and quit.
  4. Otherwise, attempt backport as usual.

but I don't know the code enough to make a PR and it does not look like I can just do a few lines simple change at that location.

OR

You can also say that we're abusing a backport bot to do forwardport and just close this as won't fix. Though would be nice to have this limitation documented at https://meeseeksbox.github.io/ if this is what you choose to do.

Thanks!

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

No branches or pull requests

3 participants