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

Support rebase/squash merges #46

Closed
korthout opened this issue May 26, 2021 · 8 comments · Fixed by #331
Closed

Support rebase/squash merges #46

korthout opened this issue May 26, 2021 · 8 comments · Fixed by #331
Labels
enhancement New feature or request

Comments

@korthout
Copy link
Owner

korthout commented May 26, 2021

Currently the action does not support rebase (and squash) merges.

Specifically, this action was build to deal with octopus merges. It does this by looking at the common ancestor of the head and base refs. But after a rebase the branch no longer points to the same head ref, which then ends up not being fetched by the action on checkout.

We should implement an alternative strategy to find all commits merged by the pull request.

UPDATE: With v1 the action no longer looks for the common ancestor, so it should support rebase/squash merges now. Please reach out if you've tried this out (both success and failure stories are appreciated), as I'd like to know whether we can consider this to be supported nowadays.

@korthout korthout added the enhancement New feature or request label May 26, 2021
@korthout
Copy link
Owner Author

An idea is to use List commits on a pull request, but the documentation is unclear about which commits will be listed. It might mean the original commits before the rebase or the commits after the rebase. Additionally, this requires dealing with pagination (max 100, default 30 per page) and has a maximum limit of requesting 250 commits.

@domenkozar
Copy link

It would be great if it reported back that this is not supported currently.

@korthout
Copy link
Owner Author

As far as I could find, it is currently not possible to know how the pull request was merged (merge commit, rebase or squash).

What I could do is add a check to see whether the commits are available to the action and if not comment on the pull request with something like:

Unable to backport this pull request automatically.
Please cherry-pick the commit(s) manually.
It seems that one or more of the commits are not available to the backport-action.
Note that rebase and squash merges are not supported at this time.
For more information see https://github.com/zeebe-io/backport-action/issues/46.

Does that help?

@domenkozar
Copy link

That's great!

@korthout
Copy link
Owner Author

@domenkozar I've merged a PR that performs this check and comments if 1 of the references cannot be found. Please let me know if you run into any problems with it.

@domenkozar
Copy link

Thank you :)

@korthout
Copy link
Owner Author

@domenkozar Since #162 I believe squash/rebase merges are supported (i.e. from v.0.0.6 onwards). I've tested a squash merge myself and I'd be curious to hear your experience. Would you have time to give it a try?

Note that the original commits on the pull request are still cherry-picked. So it does not cherry pick the squash commit (or the rebased commits) that exist on the target after the merge.

@domenkozar
Copy link

It doesn't seem to work: NixOS/nixpkgs#143639 (comment)

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

Successfully merging a pull request may close this issue.

2 participants