You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEAT]: Support ruleset allowed_merge_methods #2530
I want to be able to specify the allowed_merge_methods for both repo and org rulesets. This change depends on google/go-github#3417.
SDK Version
No response
API Version
No response
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
Reacted by Rowan Dash, Joss Whittle, Nathan Nellans, John DiMattia, Marek Uhlík, Jeff Buswell, Philipp Ranft, Atsushi Watanabe, Alexey Alekhin, Jack Plowman and 22 more
@JossWhittle I'll open a PR to implement this once my go-github PR lands and is released. But based on the outstanding PRs here with no review comments on them I wouldn't hold your breath for this to be fixed any time soon.
Reacted by Joss Whittle, Alexey Alekhin and doughlass
@at-wat at this point go-github is a long way ahead of the version used here and upgrading is likely to not be trivial as the broken project v1 REST APIs have been removed (see #2494).
But is there any ETA on when allowed_merge_methods will be added?
I've been migrating our 500 repo GitHub infrastructure to be managed by Terraform, was writing out the code to introduce rulesets and realised at terraform plan stage that I can't, this one single feature is not unavailable on the provider and will block me progressing with rulesets.
But is there any ETA on when allowed_merge_methods will be added?
I've been migrating our 500 repo GitHub infrastructure to be managed by Terraform, was writing out the code to introduce rulesets and realised at terraform plan stage that I can't, this one single feature is not unavailable on the provider and will block me progressing with rulesets.
Don't think the support is coming anytime soon. Remember seeing that they are going through a major upgrade for the dependent Go package.
In the meantime, below is a workaround I applied to create policy with allowed_merge_methods.
locals {
prevent_rebase_merge={
rules = [
{
type ="pull_request"
parameters = {
allowed_merge_methods = [
"merge",
"squash"
]
# These fields are required by the GitHub API but not directly related to specific rule functionality# They are assigned the more relaxed values intentionally.
required_approving_review_count =0
dismiss_stale_reviews_on_push =false
require_code_owner_review =false
require_last_push_approval =false
required_review_thread_resolution =false
}
}
]
}
}
resource"github_organization_ruleset""unsupported" {
name="foo"target="branch"enforcement="active"conditions {
ref_name {
include=["~DEFAULT_BRANCH"]
exclude=[]
}
}
rules {
}
lifecycle {
ignore_changes=[
rules,
]
}
provisioner"local-exec" {
command=<<-EOT echo '${jsonencode(local.prevent_rebase_merge)}' | gh api \ --method PUT \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ /orgs/${var.github_organization}/rulesets/${self.ruleset_id} \ --input - EOT
}
}
Activity
JossWhittle commentedon Jan 7, 2025
Same issue, it looks like we are both having the same day. 👍
stevehipwell commentedon Jan 7, 2025
@JossWhittle I'll open a PR to implement this once my go-github PR lands and is released. But based on the outstanding PRs here with no review comments on them I wouldn't hold your breath for this to be fixed any time soon.
nnellanspdl commentedon Jan 28, 2025
Would love to have this feature in the provider!
LukasMerz commentedon Feb 12, 2025
Would love this feature aswell!
at-wat commentedon Mar 13, 2025
The change in google/go-github seems have already been released in v69.0.0 (google/go-github#3417)
stevehipwell commentedon Mar 13, 2025
@at-wat at this point go-github is a long way ahead of the version used here and upgrading is likely to not be trivial as the broken project v1 REST APIs have been removed (see #2494).
feat: disable rule; allowed_merge_methods not yet supported
cmanfre4 commentedon Apr 7, 2025
I need this feature as well. Please consider adding it.
doughlass commentedon May 31, 2025
@kfcampbell @afrazkhan @robabbott42 @kewalaka @EricDales Apologies in tagging you all.
But is there any ETA on when
allowed_merge_methodswill be added?I've been migrating our 500 repo GitHub infrastructure to be managed by Terraform, was writing out the code to introduce rulesets and realised at
terraform planstage that I can't, this one single feature is not unavailable on the provider and will block me progressing with rulesets.yanghua-ola commentedon Jun 26, 2025
Don't think the support is coming anytime soon. Remember seeing that they are going through a major upgrade for the dependent Go package.
In the meantime, below is a workaround I applied to create policy with allowed_merge_methods.
3 remaining items
stevehipwell commentedon Oct 14, 2025
@joluizquierdo I've not seen any movement for any of my open PRs so I don't think a fix is likely to be coming any time soon.