Skip to content

Conversation

@deiga
Copy link
Collaborator

@deiga deiga commented Jan 11, 2026

[!WARN]
This PR is stacked on top of #2958
Proper diff can be looked at here
That should be reviewed and merged first

Resolves #3081


Before the change?

  • It was not possible to configure PR Required Reviewers through Rulesets

After the change?

  • It is now possible to configure PR Required Reviewers through Rulesets

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@github-actions
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@deiga deiga force-pushed the add-ruleset-rule-pr-required_reviewers branch from 152b69d to a4f0ad2 Compare January 12, 2026 20:58
@stevehipwell stevehipwell added this to the v6.11.0 Release milestone Jan 16, 2026
@stevehipwell stevehipwell added the Type: Feature New feature or request label Jan 16, 2026
deiga added 25 commits January 21, 2026 20:47
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
… to org rulesets will never be a thing

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…re empty lists by default

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…_id`

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…s.context` is not empty

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
This turns out to be failing as there is a bug in our implementation! Unit tests and fix coming up

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
deiga added 21 commits January 21, 2026 21:21
…esponse

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
As they differ from `branch` and `tag` rules

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…` and `rules`

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…anything

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…thing

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Add support for the required_reviewers rule parameter in pull_request
rules for both organization and repository rulesets. This allows
requiring specific team reviewers to approve changes based on file
patterns.

Implementation includes:
- requiredReviewersSchema() shared schema definition
- expandRequiredReviewers() for Terraform->API conversion
- flattenRequiredReviewers() for API->Terraform conversion
- Integration into expandRules() and flattenRules()
- Schema integration in both org and repo ruleset resources
Add comprehensive unit tests for the expand/flatten helper functions:
- TestExpandRequiredReviewers: validates expansion logic
- TestExpandRequiredReviewersEmpty: handles edge cases
- TestFlattenRequiredReviewers: validates flattening logic
- TestFlattenRequiredReviewersEmpty: handles edge cases
- TestRoundTripRequiredReviewers: verifies data integrity

Add acceptance tests for both organization and repository rulesets:
- Single reviewer configuration with file patterns
- Multiple reviewers configuration
- Update operations (minimum_approvals change)
- Import state verification
Add documentation for the new required_reviewers nested block
in both organization_ruleset and repository_ruleset resources.

Documents the reviewer, file_patterns, and minimum_approvals
attributes with their types and requirements.
- Add missing allowed_merge_methods field to pull_request section
- Fix merge_queue fields from Required to Optional with defaults
- Fix actor_id to show Optional with note about DeployKey
- Add DeployKey to actor_type enum list
- Add protected field to conditions.repository_name
- Fix required_code_scanning_tool anchor link
- Remove duplicate do_not_enforce_on_create
@deiga deiga force-pushed the add-ruleset-rule-pr-required_reviewers branch from a4f0ad2 to 795b147 Compare January 22, 2026 21:41
@deiga deiga changed the title |FEAT] Add ruleset rule for pull request required reviewers [FEAT] Add ruleset rule for pull request required reviewers Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: PR policy - require reviewer from specific team

2 participants