sorenlouv / backport

A simple CLI tool that automates the process of backporting commits on a GitHub repo
https://github.com/sqren/backport/blob/main/docs/config-file-options.md
Apache License 2.0
241 stars 57 forks source link

Pick target branch from first commit's suggestedTargetBranches in non-interactive mode #493

Closed karolkpl closed 2 months ago

karolkpl commented 4 months ago

When using non-interactive mode (e.g. using backport-github-action) getTargetBranches() failed to find target branch when there are >1 commit in the PR to backport:

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

Now it picks up target branch from first's commit suggestedTargetBranches. In backport-github-action every commit to backport has the same suggestedTargetBranches based on PR's labels.

Solves https://github.com/sorenlouv/backport-github-action/issues/103

FYI @sorenlouv

sorenlouv commented 2 months ago

Thank you for the contribution!