Skip to content

[FEAT]: Support ruleset allowed_merge_methods #2530

Closed

Description

@stevehipwell

Describe the need

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

Activity

  1. added
    Status: Triage
    Type: Feature
    on Jan 7, 2025
  2. JossWhittle commented on Jan 7, 2025

    @JossWhittle

    Same issue, it looks like we are both having the same day. 👍

  3. stevehipwell commented on Jan 7, 2025

    @stevehipwell
    CollaboratorAuthor

    @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.

  4. nnellanspdl commented on Jan 28, 2025

    @nnellanspdl

    Would love to have this feature in the provider!

  5. LukasMerz commented on Feb 12, 2025

    @LukasMerz

    Would love this feature aswell!

  6. moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Activeon Feb 27, 2025
  7. at-wat commented on Mar 13, 2025

    @at-wat

    The change in google/go-github seems have already been released in v69.0.0 (google/go-github#3417)

  8. stevehipwell commented on Mar 13, 2025

    @stevehipwell
    CollaboratorAuthor

    @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).

  9. cmanfre4 commented on Apr 7, 2025

    @cmanfre4

    I need this feature as well. Please consider adding it.

  10. doughlass commented on May 31, 2025

    @doughlass

    @kfcampbell @afrazkhan @robabbott42 @kewalaka @EricDales Apologies in tagging you all.

    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.

  11. yanghua-ola commented on Jun 26, 2025

    @yanghua-ola

    @kfcampbell @afrazkhan @robabbott42 @kewalaka @EricDales Apologies in tagging you all.

    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
      }
    }
  12. 3 remaining items

  13. stevehipwell commented on Oct 14, 2025

    @stevehipwell
    CollaboratorAuthor

    @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.

  14. added this to the v7.0.0 Release milestone on Nov 19, 2025
  15. removed
    Status: Triage
    on Jan 7, 2026
  16. moved this from Backlog to In Progress in Terraform Provideron Jan 7, 2026
  17. moved this from In Progress to Done in Terraform Provideron Jan 9, 2026
  18. moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Activeon Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Feature

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions