Skip to content

Conversation

@janeklb
Copy link

@janeklb janeklb commented Jan 19, 2026

Implements support for excluding specific team members from PR review assignments.

Resolves #1972

Changes:

  • Add excluded_members field to review_request_delegation
    • values should be github usernames
    • provider will translate github usernames to node IDs in a batch
  • Update GraphQL mutation to handle member exclusions based on node IDs
  • Since exclusion list is not available to be read from the API yet, manually update the terraform state.
  • Add tests
  • Update documentation with usage examples

Usage:

resource "github_team_settings" "example" {
  team_id = github_team.example.id
  review_request_delegation {
    algorithm = "ROUND_ROBIN"
    member_count = 2
    excluded_members = ["octocat"]
  }
}

@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! 🚀

@github-actions github-actions bot added the Type: Feature New feature or request label Jan 19, 2026
- Add excluded_team_member_node_ids field to review_request_delegation
- Allow teams to exclude specific members from PR review assignments
- Update schema with proper validation and documentation
- Add comprehensive test coverage for the new functionality
- Update documentation with usage examples

Resolves integrations#1972
@janeklb janeklb force-pushed the feature/team-settings-excluded-members branch from 748f47d to c7bc8af Compare January 19, 2026 23:27
- Change excluded_team_member_node_ids to excluded_team_members
- Accept GitHub usernames instead of GraphQL node IDs
- Add getUserNodeId helper function to lookup node IDs automatically
- Update tests to use friendly usernames like 'octocat', 'defunkt'
- Update documentation with simpler examples
- Makes configuration much more user-friendly and intuitive
@janeklb janeklb force-pushed the feature/team-settings-excluded-members branch from 3ee2bc2 to 638bd45 Compare January 19, 2026 23:41
@janeklb janeklb changed the title feat: add excluded_team_member_node_ids support to team settings feat: add excluded_team_member_ids support to team settings Jan 19, 2026
- Change ExcludedTeamMemberIds field type from []string to []githubv4.ID
- Convert string node IDs to githubv4.ID type when building exclusion list
- Ensures compliance with GitHub GraphQL API specification for UpdateTeamReviewAssignmentInput
@janeklb janeklb force-pushed the feature/team-settings-excluded-members branch from a4029ae to 9750a01 Compare January 19, 2026 23:52
@janeklb janeklb changed the title feat: add excluded_team_member_ids support to team settings feat: add excluded_team_members support to team settings Jan 19, 2026
Copy link
Collaborator

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janeklb based on your comment am I correct in thinking that Copilot created this whole PR for you? Are you a subject matter expert in Terraform or the GitHub API?

for _, v := range excludedMembers.(*schema.Set).List() {
if v != nil {
username := v.(string)
nodeId, err := getUserNodeId(ctx, meta, username)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an expensive operation that you're calling repeatedly, have you looked at making this require fewer API calls?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked into it but it did cross my mind to see if there's a "batch" endpoint that accepts a list of usernames instead of going one by one. I will check it out

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated -- please take a look

@janeklb
Copy link
Author

janeklb commented Jan 20, 2026

@janeklb based on your comment am I correct in thinking that Copilot created this whole PR for you? Are you a subject matter expert in Terraform or the GitHub API?

Correct -- I am not an sme in these areas. I've been wanting this feature so I tried the "code with copilot" button and iterated on the solution a little bit.

- Replace single-user getUserNodeId with batch getBatchUserNodeIds function
- Use GraphQL field aliases to fetch multiple user node IDs in one request
- Reduce API calls from N individual requests to 1 batch request
- Follow existing pattern from data_source_github_users.go
- Improve performance and API rate limit usage for teams with multiple excluded members
- Add proper error wrapping with %w format verb
@janeklb janeklb force-pushed the feature/team-settings-excluded-members branch from 0b4687e to c5627f8 Compare January 20, 2026 15:15
@janeklb janeklb force-pushed the feature/team-settings-excluded-members branch from 78dd9d5 to 9832b12 Compare January 20, 2026 16:03
- Add workaround in resourceGithubTeamSettingsRead to preserve excluded_members from current state
- GitHub's GraphQL API currently doesn't support reading back excluded team member IDs
- This prevents Terraform from showing unwanted changes during refresh operations
- Fixes test failure where excluded_members appeared as additions in plan after apply
@janeklb janeklb force-pushed the feature/team-settings-excluded-members branch from b997af0 to 67c0712 Compare January 20, 2026 16:25
@janeklb janeklb changed the title feat: add excluded_team_members support to team settings feat: add excluded_members support to team settings Jan 20, 2026
@stevehipwell
Copy link
Collaborator

@janeklb I don't think we can take this PR while there isn't a way to query the current state, that fundamentally breaks how Terraform works.

@stevehipwell stevehipwell added the Status: Blocked Some technical or requirement is blocking the issue label Jan 20, 2026
@janeklb
Copy link
Author

janeklb commented Jan 20, 2026

@janeklb I don't think we can take this PR while there isn't a way to query the current state, that fundamentally breaks how Terraform works.

Totally fair

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Blocked Some technical or requirement is blocking the issue Type: Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Exclude list for Team Code Review settings

2 participants