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

Page through existing github_team_members #1848

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

csainty
Copy link
Contributor

@csainty csainty commented Aug 18, 2023

Resolves #1847


Before the change?

  • GraphQL query is unpaged, limiting results to 100

After the change?

  • Query is paged

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?

  • Yes
  • No

I've used the paging code from elsewhere (data_github_organization) as reference, but as I lack a test environment I have not implemented a test nor tested it.
I'll look in to making a local release and test against my org, but leave it to maintainers to ensure this structure is right for the code in question.

@csainty
Copy link
Contributor Author

csainty commented Aug 18, 2023

Debug logs from local build. Working as I expected.

2023-08-18T12:10:50.406+1000 [DEBUG] provider.terraform-provider-github: {
2023-08-18T12:10:50.406+1000 [DEBUG] provider.terraform-provider-github:  "query": "query($after:String$orgName:String!$teamSlug:String!){organization(login:$orgName){team(slug:$teamSlug){members(membership:IMMEDIATE, first:100, after: $after){edges{node{login},role},pageInfo{endCursor,hasNextPage}}}}}",
2023-08-18T12:10:50.406+1000 [DEBUG] provider.terraform-provider-github:  "variables": {
2023-08-18T12:10:50.406+1000 [DEBUG] provider.terraform-provider-github:   "after": null,
2023-08-18T12:10:50.406+1000 [DEBUG] provider.terraform-provider-github:   "orgName": "****",
2023-08-18T12:10:50.406+1000 [DEBUG] provider.terraform-provider-github:   "teamSlug": "****"
2023-08-18T12:10:50.406+1000 [DEBUG] provider.terraform-provider-github:  }
2023-08-18T12:10:50.406+1000 [DEBUG] provider.terraform-provider-github: }

...

2023-08-18T12:10:51.021+1000 [DEBUG] provider.terraform-provider-github: {
2023-08-18T12:10:51.021+1000 [DEBUG] provider.terraform-provider-github:  "query": "query($after:String$orgName:String!$teamSlug:String!){organization(login:$orgName){team(slug:$teamSlug){members(membership:IMMEDIATE, first:100, after: $after){edges{node{login},role},pageInfo{endCursor,hasNextPage}}}}}",
2023-08-18T12:10:51.021+1000 [DEBUG] provider.terraform-provider-github:  "variables": {
2023-08-18T12:10:51.021+1000 [DEBUG] provider.terraform-provider-github:   "after": "Y3Vyc29yOnYyOpHOBVy_-A==",
2023-08-18T12:10:51.021+1000 [DEBUG] provider.terraform-provider-github:   "orgName": "****",
2023-08-18T12:10:51.021+1000 [DEBUG] provider.terraform-provider-github:   "teamSlug": "****"
2023-08-18T12:10:51.021+1000 [DEBUG] provider.terraform-provider-github:  }
2023-08-18T12:10:51.021+1000 [DEBUG] provider.terraform-provider-github: }

@csainty
Copy link
Contributor Author

csainty commented Aug 18, 2023

Tag @joshua9519 @jsifuentes @kfcampbell as the contributors involved in the original change

Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

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

Thank you @csainty!

@kfcampbell kfcampbell merged commit 69e5243 into integrations:main Aug 24, 2023
3 checks passed
avidspartan1 pushed a commit to avidspartan1/terraform-provider-github that referenced this pull request Feb 5, 2024
Co-authored-by: Keegan Campbell <me@kfcampbell.com>
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.

[BUG]: github_team_members does not page when fetching current state
3 participants