Skip to content

[FEAT]: Support dismissal_restriction on the ruleset pull_request rule #3698

Open

Description

@benlangfeld

Describe the need

Support dismissal_restriction on the pull_request rule of github_repository_ruleset and github_organization_ruleset.

A branch protection rule can restrict who may dismiss pull request reviews (restrict_dismissals / dismissal_restrictions). A ruleset can't express that through this provider. So a repository that moves its policy from github_branch_protection to github_repository_ruleset, as recommended in #3257, quietly lets anyone with write access dismiss reviews. That's a loosening nobody asked for, and nothing reports it.

The API already accepts it, and every ruleset the provider creates already returns the field, disabled:

{"type": "pull_request", "parameters": {"dismissal_restriction": {"allowed_actors": [], "enabled": false}, ...}}

The types arrived in go-github v93.0.0 (google/go-github#4599).

Something like:

rules {
  pull_request {
    required_approving_review_count = 1

    dismissal_restriction {
      enabled = true

      allowed_actors {
        actor_id   = 1234
        actor_type = "Team"
      }
    }
  }
}

Points that came up while trying it:

  • enabled = true with no allowed_actors means "only those who can bypass the ruleset", the equivalent of restrict_dismissals = true with empty dismissal_restrictions on branch protection.
  • actor_type takes User, Team, IntegrationInstallation or RepositoryRole, which isn't the same set as bypass actors (an app is IntegrationInstallation here but Integration there), so it needs its own validation.
  • GitHub returns dismissal_restriction whether or not one is set, so reading it back as-is would make every configuration without the block diff forever. A disabled restriction with no actors should read back as unset.
  • Both ruleset resources carry their own copy of the pull_request schema, but expandRules/flattenRules are shared.

An implementation of this is on benlangfeld:dismissal-restriction (from the closed #3658) if it's any use.

GitHub Installation Type

  • GitHub.com (Free, Pro, or Team)

Relevant log output

No response

Activity

  1. github-actions commented on Oct 22, 2026

    @github-actions

    👋 Hi, and thank you for opening this issue!

    This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can.

    You can help us prioritize by adding details, reproduction steps, or a 👍 to issues that matter to you, and by joining the discussion on open issues and PRs.


    🤖 This is an automated message.

  2. added
    Type: Bug
    Status: Triage
    Type: Feature
    and removed
    Type: Bug
    on Oct 23, 2026
  3. robert-crandall commented on Nov 25, 2026

    @robert-crandall
    Contributor

    Linking #3715 from @Overbryd here for reference. We closed it as part of our temporary move to an issue-first model (see CONTRIBUTING.md), and want to keep the context and implementation approach handy when we pick this issue up.

  4. ezcyo-tf1 commented on Dec 1, 2026

    @ezcyo-tf1

    Adding a data point from a migration we have had to postpone because of this.

    GitHub's "Migrate to rulesets" tool (changelog, 2026-08-11) keeps the dismissal restriction when it converts a branch protection. A protection with restrict_dismissals = true and one team in dismissal_restrictions came out as:

    {
      "type": "pull_request",
      "parameters": {
        "required_approving_review_count": 1,
        "dismiss_stale_reviews_on_push": true,
        "require_code_owner_review": true,
        "required_review_thread_resolution": true,
        "dismissal_restriction": {
          "enabled": true,
          "allowed_actors": [{ "id": 1234567, "type": "Team" }]
        }
      }
    }

    So GitHub's own migration path treats the restriction as part of the policy, while a migration done through this provider has to drop it. For teams that manage their repositories with Terraform, moving from github_branch_protection to github_repository_ruleset loosens who can dismiss reviews on every repository, where the UI migration would not. We manage about thirty repositories this way and are staying on github_branch_protection until this is supported.

    Two notes for whoever picks this up:

    • The converter writes the team as its numeric ID ("id": <team id>, "type": "Team"). github_branch_protection takes node IDs in dismissal_restrictions, so a migration guide should mention the change of identifier.
    • The types are in go-github v93.0.0, released 2026-10-15. The provider is still on v92, and chore: Update go-github to v93.0.0 #3705 has the upgrade.
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

    Status: TriageType: Feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions