Skip to content

backport-main label does not auto backport #123

Open

Description

@pllim

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

Activity

  1. Carreau commented on May 7, 2024

    @Carreau
    Member

    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.

  2. astrofrog commented on Jul 25, 2024

    @astrofrog

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

  3. pllim commented on Jul 25, 2024

    @pllim
    ContributorAuthor

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

  4. astrofrog commented on Jul 25, 2024

    @astrofrog

    Hmm yes sorry misremembered, time flies!

  5. Carreau commented on Jul 29, 2024

    @Carreau
    Member

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

  6. astrofrog commented on Aug 30, 2024

    @astrofrog

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

  7. astrofrog commented on Aug 30, 2024

    @astrofrog

    I just merged the PR at 11:58 GMT

  8. astrofrog commented on Aug 30, 2024

    @astrofrog

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

  9. pllim commented on Aug 30, 2024

    @pllim
    ContributorAuthor

    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.
  10. astrofrog commented on Aug 30, 2024

    @astrofrog

    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?

  11. Carreau commented on Sep 2, 2024

    @Carreau
    Member

    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.

  12. pllim commented on Sep 3, 2024

    @pllim
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions