feat: Add github_team_external_groups data source#3296
Conversation
|
👋 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 |
deiga
left a comment
There was a problem hiding this comment.
Thanks for the PR!
Partial review, left a few change requests :)
c0057e8 to
b5ae884
Compare
|
Thank you very much for the partial review @deiga! I went ahead and addressed the feedback. Let me know if anything looks off. This is my first time working on terraform provider code so I'm still ramping up on the testing framework/approach. Cheers |
| ___ | ||
|
|
||
| * `group_id` - The ID of the external group. | ||
| * `group_name` - The name of the external group. | ||
| * `updated_at` - The date the group was last updated. |
There was a problem hiding this comment.
issue: This doesn't follow the pattern in the docs, please adjust
There was a problem hiding this comment.
I assume you prefer the subfields to be a nested list under external_groups? The current patch is replicating the pattern used in website/docs/d/external_groups.html.markdown. Should I include a commit to update to use a nested list there as well?
There was a problem hiding this comment.
@deiga Thanks for another round of review.
I went ahead and pushed an update to both pages to use a nested list. I also realized I missed adding a link to the new page in website/github.erb, so I added that as well.
b5ae884 to
27f3db1
Compare
|
Thank you for the review and approval @deiga! |
27f3db1 to
27f6f31
Compare
|
I don't mean to be rude or to put any undue pressure, but I was curious if there was any estimate for when this might land? We're getting close to shipping a project that depends on this. I just need to decide if we need to organize around an internal fork or if we can use upstream directly. |
|
@orirawlings sorry, we can't promise an ETA for this. We're only community maintainers here and using our free time for this hobby. I wouldn't recommend using your own fork just for a data source, since you can use the rest_api data source as a temporary patch. While waiting for us, it would be very helpful if you can keep the PR rebased and with passing test/lint/docs checks 😊 That way we don't have to try and hunt you down once we have capacity for this |
|
Will do. Thanks @deiga! |
5cfa313 to
8aff54d
Compare
8aff54d to
74e67b0
Compare
|
Thanks for your help so far on this @deiga. I've resolved the errors on |
There was a problem hiding this comment.
Pull request overview
These provider review instructions are being used.
This PR adds a new read-only data source, github_team_external_groups, which lists the external (IdP) groups mapped to a single organization team via the GitHub REST endpoint GET /orgs/{org}/teams/{team_slug}/external-groups (go-github Teams.ListExternalGroupsForTeamBySlug). It complements the existing org-wide github_external_groups data source and resolves #3295. The implementation closely mirrors github_external_groups, registering the data source in the provider and exposing the same group_id/group_name/updated_at output shape, keyed by the team slug.
Changes:
- New
github_team_external_groupsdata source (schema + read logic) returning a team's external groups. - Provider registration and generated docs for the new data source.
- Acceptance tests covering the not-found error path and the empty-list path.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
github/provider.go |
Registers the new github_team_external_groups data source. |
github/data_source_github_team_external_groups.go |
Implements the schema and read function; nested attributes lack Description. |
github/data_source_github_team_external_groups_test.go |
Adds acceptance tests; PreCheck guard (skipUnlessHasOrgs) is likely too weak for EMU-only external groups. |
docs/data-sources/team_external_groups.md |
Generated docs; lacks an Example Usage section because no example file was added. |
Residual risk: The "returns empty list" acceptance test depends on GitHub returning an empty list (rather than an error) for a non-externally-managed team; this could not be fully verified and may behave differently outside an EMU enterprise.
| "external_groups": { | ||
| Type: schema.TypeList, | ||
| Computed: true, | ||
| Elem: &schema.Resource{ | ||
| Schema: map[string]*schema.Schema{ | ||
| "group_id": { | ||
| Type: schema.TypeInt, | ||
| Computed: true, | ||
| }, | ||
| "group_name": { | ||
| Type: schema.TypeString, | ||
| Computed: true, | ||
| }, | ||
| "updated_at": { | ||
| Type: schema.TypeString, | ||
| Computed: true, | ||
| }, | ||
| }, | ||
| }, | ||
| }, |
| func dataSourceGithubTeamExternalGroups() *schema.Resource { | ||
| return &schema.Resource{ | ||
| Description: "Retrieve external groups for a specific GitHub team.", | ||
| ReadContext: dataSourceGithubTeamExternalGroupsRead, |
| `, teamName) | ||
|
|
||
| resource.Test(t, resource.TestCase{ | ||
| PreCheck: func() { skipUnlessHasOrgs(t) }, |
| ` | ||
|
|
||
| resource.Test(t, resource.TestCase{ | ||
| PreCheck: func() { skipUnlessHasOrgs(t) }, |
Resolves #3295
Before the change?
After the change?
github_team_external_groupsdata source for loading the external groups mapped to a given team.Pull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!