Gaurav0 / backport

🔙 GitHub Action to backport pull requests
7 stars 7 forks source link

support rebase merges by collecting series of commits from PR #43

Open sgtcoolguy opened 4 years ago

sgtcoolguy commented 4 years ago

The current bot implementation supports only single-commit PR merges. This works great for squash merges, and I see it now sort-of works for merge commits. But it doesn't support rebased merges (unless there's only one eventual commit merged).

The electron/trop bot seems to handle multi-commit merges: https://github.com/electron/trop/blob/f3facf6f854f24e5d8453f2b3caae9c97fbfa876/src/utils.ts#L213-L310

Specifically, it asks for the list of commits on the PR, and pulls down the patches for those commits and then applies them in series. See https://github.com/electron/trop/blob/f3facf6f854f24e5d8453f2b3caae9c97fbfa876/src/operations/backport-commits.ts

It's likely much faster for single-commit PRs to keep the current cherry-pick logic, but for multi-commit PRs this may be useful.