Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support team organization role assignment #2322

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

felixlut
Copy link
Contributor

@felixlut felixlut commented Jul 17, 2024

Resolves #2314


Before the change?

  • It was not possible to assign an organization role to a team with the Terraform provider

After the change?

Pull request checklist

  • 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, this is a brand new resource

}

octokitClient, err := pkg.NewApiClient(
// pkg.WithUserAgent("my-user-agent"), // Should this be set to terraform-provider-github or similar? Doesn't look like the user-agent is set for the other clients
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like the provider is not setting the user-agent for the other clients, but maybe it should?

}

// There is no api for checking a specific team role assignment, so instead we iterate over all teams assigned to the role
// go-github pagination (https://github.com/google/go-github?tab=readme-ov-file#pagination)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using google/go-github here instead of octokit/go-sdk since the former doesn't support pagination


randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)

// Using the predefined roles since custom roles are a strictly Enterprise feature ((https://github.blog/changelog/2024-07-10-pre-defined-organization-roles-that-grant-access-to-all-repositories/))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since custom organization roles are a Enterprise level feature, I have elected to not use them in the tests and instead use the built-in roles instead. I've created a manual mapping for their role_id:s here. Not ideal, but I don't have a better way of testing this

@ChristopherMank
Copy link

Looking forward to this feature! Any thoughts on when it might be implemented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT]: add support for pre-defined organization roles
2 participants