Skip to content

Commit

Permalink
Disable automerge on private repositories
Browse files Browse the repository at this point in the history
It turns out that GitHub doesn't support auto-merging pull requests on
private repositories [1]. The request to set the attribute is accepted
without error, but doesn't actually change anything. This causes noise in
the output of `tofu apply` since it's constantly trying to re-apply the
change.

Update the `common_repository` module so that we set
`allow_auto_merge=false` for private repositories.

[1]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request
  • Loading branch information
larsks committed Feb 7, 2025
1 parent 5977743 commit a4e655a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/common_repository/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resource "github_repository" "repo" {
visibility = var.visibility
description = var.description
auto_init = true
allow_auto_merge = true
allow_auto_merge = var.visibility == "private" ? false : true
has_issues = true
has_downloads = false
has_projects = false
Expand Down

0 comments on commit a4e655a

Please sign in to comment.