runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.73k stars 1.05k forks source link

Automerge does not work is merge commits are not allowed #4828

Open paymog opened 1 month ago

paymog commented 1 month ago

Community Note


Overview of the Issue

Automerge does not work if merge commits are not allowed.

image

Reproduction Steps

  1. Disable merge commits
  2. Enable automerge
  3. put up pr and plan/apply it
  4. see failure

Logs

atlantis-0 atlantis {"level":"error","ts":"2024-08-09T15:04:25.498Z","caller":"vcs/instrumented_client.go:241","msg":"Unable to merge pull, error: merging pull request: PUT https://api.github.com/repos/goldsky-io/goldsky-infra/pulls/1302/merge: 405 This branch must not contain merge commits. You're not authorized to push to this branch. Visit https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches for more informati []","json":{"repo":"goldsky-io/goldsky-infra","pull":"1302"},"stacktrace":"github.com/runatlantis/atlantis/server/events/vcs.(*InstrumentedClient).MergePull\n\tgithub.com/runatlantis/atlantis/server/events/vcs/instrumented_client.go:241\ngithub.com/runatlantis/atlantis/server/events/vcs.(*ClientProxy).MergePull\n\tgithub.com/runatlantis/atlantis/server/events/vcs/proxy.go:93\ngithub.com/runatlantis/atlantis/server/events.(*AutoMerger).automerge\n\tgithub.com/runatlantis/atlantis/server/events/automerger.go:35\ngithub.com/runatlantis/atlantis/server/events.(*ApplyCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/apply_command_runner.go:184\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:367"}
atlantis-0 atlantis {"level":"error","ts":"2024-08-09T15:04:25.498Z","caller":"events/automerger.go:38","msg":"automerging failed: merging pull request: PUT https://api.github.com/repos/goldsky-io/goldsky-infra/pulls/1302/merge: 405 This branch must not contain merge commits. You're not authorized to push to this branch. Visit https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches for more informati []","json":{"repo":"goldsky-io/goldsky-infra","pull":"1302"},"stacktrace":"github.com/runatlantis/atlantis/server/events.(*AutoMerger).automerge\n\tgithub.com/runatlantis/atlantis/server/events/automerger.go:38\ngithub.com/runatlantis/atlantis/server/events.(*ApplyCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/apply_command_runner.go:184\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:367"}
paymog commented 1 month ago

It would be great if we could have a config option to choose between merge and rebase when merging the PR