terraform-provider-github
terraform-provider-github copied to clipboard
[Feature Request] "github_repository" default merge action
I would like to be able to have the default merge action for a repo created with github_repository
have a default merge action that is configurable.
By default I want users to Squash and Merge
but I don't want to disallow allow_merge_commit
or allow_rebase_merge
.
In my experience, GitHub repos default to Merge pull request
(Create a merge commit), retaining the history of all previous commits, until the user clicks the green dropdown and selects Squash and merge
at least once. This has me concerned that this could be a per-user setting but I would like to be able to set the default on a per-repo (per org?) basis.
Affected Resource(s)
-
github_repository
Terraform Configuration Files
resource "github_repository" "example" {
name = "example"
description = "My awesome codebase"
visibility = "public"
allow_merge_commit = true
allow_squash_merge = true
allow_rebase_merge = true
default_merge_action = "squash_merge"
}
Related
- https://github.community/t/squash-and-merge-as-default-pull-request-merge-option/1031
👋 Hey Friends, this issue has been automatically marked as stale
because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned
label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
@jfreeland , I would also have loved such a feature but if I'm not mistaken, this feature doesn't exist on GitHub itself, therefore making it impossible to support this in this Terraform provider?
The GitHub feature request is here: https://github.com/community/community/discussions/20583
From my understanding, the current behavior is that the default merge action is only set on a per-user basis (last selected option for a repository is the proposed default action).
Did I miss something?
2 additional notes:
- The GitHub discussion link in your issue description seems dead?
- Just passing by when browsing the issues, I'm not maintaining anything here, do not take that as any kind of authoritative answer :smile:
It seems now implemented by GitHub: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests