-
Notifications
You must be signed in to change notification settings - Fork 774
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
Provide "require signed commits" on github_branch_protection
#212
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Update imports as go-github converted to using modules starting with v18. Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
This commit includes the `required_approving_review_count` field on the `github_branch_protection` resource, allowing to manage the miminum amount of reviewers to allow a merge to happen. This field must be between 1 - 6, according to the docs, and must be valid if present. Bumping the `go-github` to `v24` made it default to `0` when not present, causing the followin error <detail> <summary>GitHub API error when count is 0</summary> ``` 422 Invalid request. No subschema in "anyOf" matched. 0 must be greater than or equal to 1. Not all subschemas of "allOf" matched. For 'anyOf/1', {"dismissal_restrictions"=>{"users"=>[], "teams"=>[]}, "dismiss_stale_reviews"=>false, "require_code_owner_reviews"=>true, "required_approving_review_count"=>0} is not a null. [] Payload: { "required_status_checks": { "strict": true, "contexts": [ "lint", "test" ] }, "required_pull_request_reviews": { "dismissal_restrictions": { "users": [], "teams": [] }, "dismiss_stale_reviews": false, "require_code_owner_reviews": true, "required_approving_review_count": 0 }, "enforce_admins": true, "restrictions": null } ``` </detail> This PR is important when upgrading `go-github`. Built on top of: https://github.com/terraform-providers/terraform-provider-github/pull/207
This commit provides changing the toggle to require signed commits on branch protection. The [API for signed commits](https://developer.github.com/v3/repos/branches/#get-required-signatures-of-protected-branch) is separate endpoint from the branch protection url, and does not come on the same payload. This means that we need to make an extra request to read and modify it. This changes requires `go-github` at least v19. Need: - [ ] Update `go-github` version: https://github.com/terraform-providers/terraform-provider-github/pull/207 - [ ] Provide default required reviewers count to avoid GitHub update error: https://github.com/terraform-providers/terraform-provider-github/pull/211 Closes https://github.com/terraform-providers/terraform-provider-github/issues/87
ghost
added
the
size/XXL
label
Apr 23, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit provides changing the toggle to require signed commits on
branch protection.
The API for signed commits
is separate endpoint from the branch protection url, and does not come on the same payload.
This means that we need to make an extra request to read and modify it.
This changes requires
go-github
at least v19.Needs:
go-github
version: https://github.com/terraform-providers/terraform-provider-github/pull/207Closes https://github.com/terraform-providers/terraform-provider-github/issues/87