sorenlouv / backport-github-action

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

Backport fails randomly due to "no-branch-exception" #103

Closed raubel closed 2 months ago

raubel commented 1 year ago

Hi,

We use this tool a lot in my company, thanks for it! However, sometimes, the backport fails for the following reason:

Error: There are no branches to backport to. Aborting

We didn't manage to understand the context of this failure (we even tried to keep branches after merge but we still have the issue).

Do you know why it happens? Is there any fix/workaround to make it fully reliable? Thank you for any help.

sarod commented 1 year ago

Adding a bit more information on top of @raubel.

The version used is sqren/backport-github-action@v8.9.0 Here is an example log produced by the execution when the error occurs.;

{
  assignees: [ '<user>' ],
  branchLabelMapping: { '^backport-to-(.+)$': '$1' },
  pullNumber: 1808,
  repo: { owner: '<org>', repo: '<repo>' },
  repoForkOwner: '<org>'
}
Result {
  "status": "aborted",
  "commits": [
    {
      "author": {
        "name": "<author>",
        "email": "<email>"
      },
      "sourceCommit": {
        "committedDate": "2023-04-12T16:48:28Z",
        "message": "Message for 6ac19318fca8c2148751fbd0a0edee5f26df87cb",
        "sha": "6ac19318fca8c2148751fbd0a0edee5f26df87cb"
      },
      "sourcePullRequest": {
        "labels": [
          "auto-backport",
          "backport-to-V2023_2"
        ],
        "number": 1808,
        "url": "https://github.com/<org>/<repo>/pull/1808",
        "mergeCommit": {
          "message": "Message for 0c16cacf9aed1ec7ed8142fa5a9b0018d023b5f5",
          "sha": "0c16cacf9aed1ec7ed8142fa5a9b0018d023b5f5"
        }
      },
      "sourceBranch": "master",
      "suggestedTargetBranches": [
        "V2023_2"
      ],
      "targetPullRequestStates": [
        {
          "branch": "V2023_2",
          "label": "backport-to-V2023_2",
          "labelRegex": "^backport-to-(.+)$",
          "isSourceBranch": false,
          "state": "NOT_CREATED"
        }
      ]
    },
    {
      "author": {
        "name": "<author>",
        "email": "<email>"
      },
      "sourceCommit": {
        "committedDate": "2023-04-12T16:48:28Z",
        "message": "Message for 0c16cacf9aed1ec7ed8142fa5a9b0018d023b5f5",
        "sha": "0c16cacf9aed1ec7ed8142fa5a9b0018d023b5f5"
      },
      "sourcePullRequest": {
        "labels": [
          "auto-backport",
          "backport-to-V2023_2"
        ],
        "number": 1808,
        "url": "https://github.com/<org>/<repo>/pull/1808",
        "mergeCommit": {
          "message": "Message for 0c16cacf9aed1ec7ed8142fa5a9b0018d023b5f5",
          "sha": "0c16cacf9aed1ec7ed8142fa5a9b0018d023b5f5"
        }
      },
      "sourceBranch": "master",
      "suggestedTargetBranches": [
        "V2023_2"
      ],
      "targetPullRequestStates": [
        {
          "branch": "V2023_2",
          "label": "backport-to-V2023_2",
          "labelRegex": "^backport-to-(.+)$",
          "isSourceBranch": false,
          "state": "NOT_CREATED"
        }
      ]
    }
  ],
  "error": {
    "name": "BackportError",
    "errorContext": {
      "code": "no-branches-exception"
    }
  },
  "errorMessage": "There are no branches to backport to. Aborting."
}

@sqren is there any additional logs we could enable to understand the error better?

s0undt3ch commented 12 months ago

We have also hit this issue frequently

sorenlouv commented 10 months ago

Hi there,

Sorry for the slow reply!

I recently released a new version of the github action (9.2.1). Can you please try that out and let me know how it goes? It has some additional logging that might shed some light on this.

Thanks!

raubel commented 10 months ago

Thanks @sqren, we now use version 9.3.0. We'll let you know when it happens again (with the logs).

laeubi commented 8 months ago

I think this happens when there are more than one commit:

https://github.com/eclipse-tycho/tycho/actions/runs/6747800057/job/18344749747

Still happens on 9.3.0 ...

laeubi commented 8 months ago

By the way if I go to the branch and cherry pick the both commits independently it works without a problem see:

laeubi commented 5 months ago

@sorenlouv can you give some feedback about the problem when backporting PRs that contain more than one commit?

We heavily use that action but having only ever one commit is sometimes limiting ...

jchappelow commented 2 months ago

Can backport be bumped to v9.5 or latest so the action gets the fix from https://github.com/sorenlouv/backport/pull/493? Thanks! This is a nice action to have.

sorenlouv commented 2 months ago

Fixed in https://github.com/sorenlouv/backport-github-action/pull/121 via https://github.com/sorenlouv/backport/pull/493