Skip to content

feat: Update repository collaborators to ignore non-direct teams - #3571

Merged
deiga merged 5 commits into
mainfrom
fix-repository-collaborators-indirect-teams
Jul 24, 2026
Merged

feat: Update repository collaborators to ignore non-direct teams#3571
deiga merged 5 commits into
mainfrom
fix-repository-collaborators-indirect-teams

Conversation

@stevehipwell

@stevehipwell stevehipwell commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Resolves #2781
Resolves #2623


Before the change?

  • The github_repository_collaborators resource would churn with organization or enterprise teams present and not passed in via 1ignore_teams`

After the change?

  • The github_repository_collaborators resource ignores non-direct teams so no longer churns with organization or enterprise teams present
  • The github_repository_collaborators resource ignore_teams field has been deprecated as it's no longer needed (usage for any other reason than ignoring organization or enterprise times was never supported)

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

@stevehipwell stevehipwell added this to the v6.14.0 milestone Jul 23, 2026
@stevehipwell
stevehipwell requested a review from deiga July 23, 2026 12:32
@stevehipwell stevehipwell self-assigned this Jul 23, 2026
@stevehipwell stevehipwell added the Type: Feature New feature or request label Jul 23, 2026
@github-actions

Copy link
Copy Markdown

👋 Hi, and thank you for this contribution!

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 joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions.


🤖 This is an automated message.

@github-actions github-actions Bot added the Type: Bug Something isn't working as documented label Jul 23, 2026
@stevehipwell stevehipwell removed the Type: Bug Something isn't working as documented label Jul 23, 2026
@stevehipwell
stevehipwell requested a review from Copilot July 23, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

These provider review instructions are being used.

Updates repository collaborator management to exclude teams without direct repository access and reduce Terraform drift.

Changes:

  • Filters inherited organization and enterprise teams.
  • Deprecates ignore_team and expands import state population.
  • Refactors acceptance tests and helpers.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
RESOURCES.md Updates resource readiness status.
github/resource_github_team_members_test.go Adopts refactored team helpers.
github/resource_github_repository_collaborators.go Implements collaborator filtering, hashing, pagination, and import changes.
github/resource_github_repository_collaborators_test.go Reworks collaborator acceptance coverage.
github/data_source_github_team_test.go Adopts team helpers.
github/data_source_github_team_repositories_test.go Adopts repository-team helper.
github/data_source_github_team_members_test.go Adopts parent-team helper.
github/data_source_github_repository_teams_test.go Adopts repository-team helper.
github/data_source_github_organization_teams_test.go Adopts team helpers.
github/data_source_github_organization_role_users_test.go Refactors role assignment setup.
github/data_source_github_organization_role_teams_test.go Refactors role assignment setup.
github/acc_helpers_test.go Removes migrated acceptance helpers.
github/acc_helpers_team_test.go Adds dedicated team test helpers.
github/acc_helpers_repository_test.go Adds dedicated repository test helpers.
docs/resources/repository_collaborators.md Documents deprecation and description changes.
Comments suppressed due to low confidence (1)

github/resource_github_repository_collaborators.go:93

  • The custom set hash excludes permission, so a permission-only team change has the same set identity and can produce no resource diff. The update callback then never applies the new repository permission. Include permission in this hash as well as the normalized team identity.
				Set: func(v any) int {
					teamIDStr, _ := v.(map[string]any)["team_id"].(string)
					return schema.HashString(strings.ToLower(teamIDStr))
				},

Comment thread github/resource_github_repository_collaborators.go Outdated
Comment thread github/acc_helpers_team_test.go
Comment thread github/resource_github_repository_collaborators.go Outdated

@deiga deiga left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work!

Comment thread github/acc_helpers_team_test.go Outdated
Comment thread github/resource_github_repository_collaborators.go Outdated
Comment thread github/resource_github_repository_collaborators.go Outdated
@github-actions github-actions Bot added the Type: Bug Something isn't working as documented label Jul 23, 2026
@stevehipwell
stevehipwell requested review from Copilot and deiga July 23, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Comment thread github/resource_github_repository_collaborators.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Comment thread github/resource_github_repository_collaborators.go
Comment thread docs/resources/repository_collaborators.md
Comment thread github/resource_github_repository_collaborators.go
Comment thread github/acc_helpers_team_test.go
Comment thread github/resource_github_repository_collaborators.go Outdated
@stevehipwell

Copy link
Copy Markdown
Collaborator Author

I think if we use StateFunc to lowercase, that would do the same thing and remove the need for a bunch of ToLower calls 🤔

We don't need to use StateFunc so we shouldn't, AFAIK it's removed in the framework.

@stevehipwell
stevehipwell requested a review from deiga July 23, 2026 16:23

@deiga deiga left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@stevehipwell stevehipwell added the needs-github-review Request a review from GitHub label Jul 24, 2026
@stevehipwell
stevehipwell force-pushed the fix-repository-collaborators-indirect-teams branch from 9781424 to 78548e6 Compare July 24, 2026 08:10
@stevehipwell
stevehipwell force-pushed the fix-repository-collaborators-indirect-teams branch from 78548e6 to a88eaba Compare July 24, 2026 08:36

@robert-crandall robert-crandall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for tackling this, @stevehipwell. I built and vetted it locally on Go 1.26 (including the neat new(expr) usage) and everything's green; the deprecation path for ignore_team and the import state hydration both look right to me. 👍

@deiga
deiga merged commit b0b30a1 into main Jul 24, 2026
11 checks passed
@deiga
deiga deleted the fix-repository-collaborators-indirect-teams branch July 24, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-github-review Request a review from GitHub Type: Bug Something isn't working as documented Type: Feature New feature or request

Projects

None yet

4 participants