WIP: Migrate include_admins to enforce_admins in Github API #14195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's been a breaking change in the GitHub API in the last day or so which changes the format of the request/response for the Branches Protection API call. The options for
include_admins
on each of the settings has been removed, and an all-encompassingenforce_admins
has been provided for setting at the branch level.Also, the API supports control over who can dismiss pull request reviews and management of stale reviews.
I've updated the code, tests, and documentation with the new details, and run some Acceptance Tests for Github. I've had some issues with this whereby users are getting removed from the organisation on the test, and it's not repeatable, so I'm not 100% confident in the results. For example:
But
some_user
cannot be added back in as they are no longer part of the Organisation. The requests and response processing do at least seem to work as expected.TODO:
dismissal_restrictions
so that the default generated byresourceGithubBranchProtection
matches the "empty" value returned by the API response.enforce_admins
and the newdismiss*
options.vendor/
updates with upstream repositories.I will aim to add some of these in the coming days, but I welcome reviews on my code so far (bit rusty in Golang) and make sure I'm on the right track for Terraform.