Skip to content

Adding skeleton for github_team_settings resource - #1356

Merged
nickfloyd merged 16 commits into
integrations:mainfrom
elliottpope:SupportingTeamReviewerSettings
Nov 16, 2022
Merged

nickfloyd merged 16 commits into
integrations:mainfrom
elliottpope:SupportingTeamReviewerSettings

Conversation

@elliottpope

Copy link
Copy Markdown
Contributor

Added tests for the code reviewer delegation settings to validate that the settings get updated correctly, the schema is validated correctly, and the team can be specified via slug or ID Adding the resource to the provider configuration

Added tests for the code reviewer delegation settings to validate that the settings get updated correctly, the schema is validated correctly, and the team can be specified via slug or ID
Adding the resource to the provider configuration
GitHub Team settings through GraphQL is a preview capability
Needed to add the ability to inject arbitrary custom headers into the GitHub HTTP client to allow the github_team_settings resource to access the preview fields of the Team object
Slug is used during GraphQL queries and UID is used during mutations
Will need to resolve slug/numeric ID to UID during create stage
Added struct for Team GraphQL query
Accidentally retained a github_team_repository reference from copy/paste
Added logic to resolve Team node ID (used by GraphQL) from either numeric ID (used by REST API) or slug (used by Web interface) on creation of the settings resource
Need to continue to store the slug and node_id since they are used by later queries and mutations through the GraphQL API
Added json struct tags to the UpdateTeamReviewAssignmentInput since it is serialized as JSON when passed to the GraphQL API as the  variable
Renamed UpdateTeamReviewAssignment input struct to match what is present as a named input in the GitHub GraphQL documentation as the graphQL API validates the input schema when a named input type is specified
Retriving the slug and ID from the Terraform state since they are added on creation
Ensuring that the update method will apply changes if the resource is new or if there are changes to the data since create simply resolves the necessary data (node ID and slug) and then delegates the actual changes to the update method
Deleting the resource will reset all of the values to their defaults
There was a test case to check that an apply would fail if delegation=false but other values were set (since nothing happens if delegation=false however there is not elegant way to validate that other fields are non-default if delegation=false
…the test to force migration in the main implementation
…e github_team_settings schema

If review_request_delegation is nil then delegation is disabled. If present (i.e. list of 1 element) then settings will be applied
Created a default team settings function for updating via GraphQL
@elliottpope
elliottpope marked this pull request as ready for review November 13, 2022 18:37
@elliottpope

elliottpope commented Nov 13, 2022 •

Copy link
Copy Markdown
Contributor Author

Resolves #1249

@ahmedwonolo

Copy link
Copy Markdown

Thank you for working on this @elliottpope!!! Much needed feature.
Hopefully gets merged soon.

@nickfloyd nickfloyd added Priority: Normal Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR labels Nov 15, 2022

@nickfloyd nickfloyd 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.

This is a fantastic add to the provider! Thank you for doing it! ❤️

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

Labels

Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants