Open llamahunter opened 3 years ago
Hmm, we have code to detect which merge method to use:
const (
defaultMergeMethod = "merge"
rebaseMergeMethod = "rebase"
squashMergeMethod = "squash"
)
method := defaultMergeMethod
if !repo.GetAllowMergeCommit() {
if repo.GetAllowRebaseMerge() {
method = rebaseMergeMethod
} else if repo.GetAllowSquashMerge() {
method = squashMergeMethod
}
}
// Now we're ready to make our API call to merge the pull request.
options := &github.PullRequestOptions{
MergeMethod: method,
}
Can you make the GET repository API call and see what the value of the:
AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"`
AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"`
AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"`
fields are?
Hmm... I think there might be some conflation between the global repo Options setting:
and the specific Branch Protection Rule:
Just because the whole repo allows merge commits does not mean all branches do.
Might need a call to https://docs.github.com/en/rest/reference/repos#get-branch-protection somewhere in that logic
Looks like that's the issue. For now you'll have to relax that rule or change your global repo settings.
I've encountered this in a current client and I would propose rather than using the API to get the configuration of the repo to use a configuration variable in Atlantis to allow GitHub users to select their merge method.
While this could be automated the revert showed that Atlantis does not currently have the permissions for this in most cases and providing more permissions to Atlantis to solve this might not be an option in all cases.
Are there any plan to implement/solve this feature as suggested in the previous comment?
When the automerge feature is enabled, but the target branch only supports linear history (i.e. not merge commits), atlantis fails to squash/merge the commit to the target branch after successful apply.
It looks like this issue was briefly raised in the original implementation of automerge, but seems to have gotten lost. https://github.com/runatlantis/atlantis/issues/186#issuecomment-446626233
Currently, we get this error on our repos:
Is this an oversight, or is this purposefully unsupported?