-
-
Notifications
You must be signed in to change notification settings - Fork 663
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
[FR] New mergeMethod merge-ff
to only merge when un-fast-forwardable, otherwise hard reset
#448
Comments
merge ff isn't a supported merge method on GitHub pull requests. I recommend using a github actions to achieve your specific use-case. |
Nope. It seems that you misunderstood my words. I did know and didn't mean to use the nonexistent ff-merge method. Instead, if the PR is ff-able, The title is:
|
Thanks for the clarification. Could you help me identify if ff-able status on a PR can be retrieved using GitHub API? https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request |
Some tricks are needed. It must be a fork of the upstream repo.
https://docs.github.com/en/rest/commits/commits#compare-two-commits An un-ff-able sample here:
{
"status": "diverged",
"ahead_by": 133, // the fork is ahead upstream by 133 commits
"behind_by": 1 // the fork is behind upstream by 1 commit
} An ff-able sample here:
{
"status": "behind", // ff-able
"ahead_by": 0,
"behind_by": 1 // the fork is behind upstream by 1 commit
} Note: I use a commit SHA for
Alternatively, if it is a fork and does not use a branch name different from upstream, maybe https://docs.github.com/en/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository? It defaults to ff-merge if ff-able. But the disadvantage is it will create a merge commit automatically if not ff-able and we can't take the control of this behavior. |
Thanks for the thorough example! It looks like pull just needs to call the compare endpoint you shared when the |
A nice mix of two current
mergeMethod
:hardreset
andmerge
. Effectively simulate the defaultgit merge
behavior and make the commit history clean.A use case:
DIYgod/RSSHub has a
pull.yml
configuration file withmergeMethod: merge
to prevent pull[bot] from overriding downstream manipulated forks (DIYgod/RSSHub#9710). In such a case,merge-ff
is a better solution.The text was updated successfully, but these errors were encountered: