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 failed label #211

Open
mjlbach opened this issue Dec 25, 2021 · 8 comments
Open

Add backport failed label #211

mjlbach opened this issue Dec 25, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@mjlbach
Copy link

mjlbach commented Dec 25, 2021

It would be useful to automatically add a label when the backport failed, to make it easier to track which backports need to be handled manually.

@korthout
Copy link
Owner

That's an interesting idea 💡

Currently the alerting is done via:

  • the action creating a comment on the pull request
  • the workflow run error notification if something went really wrong or it was unable to create a comment

Generally the comment can be created in most failure cases, unless:

  • there are network issues or issues with GitHub APIs
  • the GITHUB_TOKEN does not have permissions to create a comment
  • or if there is some bug (e.g. somehow the wrong pull request number is used)

I might have missed some failure cases here, but in general any other cases should be covered by the workflow run error.

Anyways, adding a label can be done for all the same situations as creating the comment, as it also depends on the same properties (GH API, TOKEN, etc). I'd prefer to have it configurable where the default configuration is to not add a label, to keep behaviour the same for other users.

@mjlbach Is this what you had in mind? And how do you feel about the other failure cases? Sadly, this cannot be a catch-all solution.

@mjlbach
Copy link
Author

mjlbach commented Dec 27, 2021

I think those are fine :) Usually the failure cases I'm running into are still commented (backports applied in the wrong order) and I just want a nice way in the GH ui to take a look at the ones that failed. I realize it wouldn't be a catch-all since failures in the GH API itself are inevitably going to result in some misses.

@korthout korthout added the enhancement New feature or request label Dec 26, 2022
@alxgrk
Copy link
Contributor

alxgrk commented Jan 12, 2023

Hi @korthout,

thanks for creating this action, really helpful.

I find the idea of labelling the PR very useful as well, especially when the cherry-pick fails. Atm, the creation of the comment is the only notification in such cases, and there is no other way to know whether the cherry-pick failed.

Alternatively, if you could add that information to the action's output that would be sufficient as well. One can then react on the result in a subsequent step.

Best,
Alex

@korthout
Copy link
Owner

I agree @alxgrk. The failure scenarios can be improved, and your alternative sounds like a good idea, enabling more flexibility. Would you be willing to contribute such a solution? If not, I'll pick this up at some point. I'm sure my team would appreciate this as well.

@alxgrk
Copy link
Contributor

alxgrk commented Jan 15, 2023

@korthout, created a PR. Wasn't sure how to test it, though - do you have some kind of playground for this project?

@korthout
Copy link
Owner

Wow! Thanks for this, @alxgrk! I built an E2E testing project for this https://github.com/korthout/backport-action-test 😄 (sadly doesn't cover conflicts yet, but I can do that manually)

@korthout
Copy link
Owner

korthout commented Jan 16, 2023

There appears to be an issue with GH at the moment

branch 'case1-new-changes' set up to track 'origin/case1-new-changes'.
+ gh pr create --head case1-new-changes --base main --title 'Case(1): Add a changed line' --body 'Adds a changed line' --label 'backport case1-backport-target'
https://github.com/korthout/backport-action-test/pull/210
+ gh pr merge --merge --auto --subject 'case(1): merge pull request'
! Pull request #202 (Case(1): Add a changed line) has diverged from local branch

Clearly, the E2E test created a PR (korthout/backport-action-test#210), but it does not exist. So the CLI struggles because the latest run with changes that looked like this was 202 but doesn't match the same history.

I'll continue the test later when GH has resolved its issue.

EDIT: issue is confirmed now

korthout added a commit that referenced this issue Jan 17, 2023
feat: generate output regarding backport result (#211)
@korthout
Copy link
Owner

@mjlbach With release Backport-action v1.1.0, there's now a workaround available. You can use the outputs to determine whether the backport-action was successful. If it was unsuccessful, you could use an action like Labeler to label your pull request.

I still keep this issue open because I think it's valuable if the action could just label the pull request out of the box, with batteries included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants