sorenlouv / backport-github-action

Backport CLI tool as a Github Action
https://github.com/sqren/backport
24 stars 16 forks source link

Action fails on PRs that are not backported #127

Open mrgrain opened 1 month ago

mrgrain commented 1 month ago

Using the example workflow in the readme, the action will fail when a PR is merged that does not have a backport label. This is functionally correct, but causes confusion because the PR is now displayed with a ❌ (red x) next to it.

Do you have any suggestion how this could be avoided? To me it feels like the Action should succeed because the PR does not have any relevant labels attached. But I am open to other suggestions.

Here is the error:

  "error": {
    "name": "BackportError",
    "errorContext": {
      "code": "no-branches-exception"
    }
  },
  "errorMessage": "There are no branches to backport to. Aborting."

Example Workflow run: https://github.com/aws/jsii-rosetta/actions/runs/9088130104/job/24977165701 Example PR: https://github.com/aws/jsii-rosetta/pull/1359

Achllle commented 3 weeks ago

I agree with this. Also when the PR hasn't been merged, the check will fail, which is also not great if you're requiring all checks to have passed to allow merging. Adding a simple condition to not run in those cases should suffice, like is done in tibdex/backport.

mrgrain commented 3 weeks ago

I agree with this. Also when the PR hasn't been merged, the check will fail, which is also not great if you're requiring all checks to have passed to allow merging. Adding a simple condition to not run in those cases should suffice, like is done in tibdex/backport.

Thanks for the link! I've already had a condition: https://github.com/aws/jsii-rosetta/blob/6d6cf286dee0d344c1a52c4c620e02f1093ed6b7/.github/workflows/backport.yml#L16

But using the github.event.label.name to check the name of the actual label is a good idea!

Achllle commented 3 weeks ago

Consider making a PR since it's a good default :wink: If not, I can make one