Skip to content

resource/github_branch_protection: Add support for require_code_owners_review - #51

Merged
radeksimko merged 1 commit into
integrations:masterfrom
denniswebb:require-code-owners-review
Feb 15, 2018
Merged

radeksimko merged 1 commit into
integrations:masterfrom
denniswebb:require-code-owners-review

Conversation

@denniswebb

@denniswebb denniswebb commented Oct 5, 2017 •

Copy link
Copy Markdown
Contributor

This resolves terraform-providers/terraform-provider-github#50

Blocked until google/go-github#744 is merged adding support for require_code_owners_review

Requires #60 to be merged. I can rebase afterwards.

@radeksimko radeksimko added Upstream Type: Feature New feature or request labels Oct 9, 2017
@denniswebb

Copy link
Copy Markdown
Contributor Author

This PR adds support for require_code_owner_reviews for pull request review branch protection.

Updating the github.com/google/go-github vendored library was required for this support.

Other changes:

  • Fix failing test TestAccGithubBranchProtection_basic by adding step to delete PullRequestReview settings if nil because github API does not remove when set to nil in branch protection requests.
  • Updated resource_github_repository_collaborator to use ListCollaboratorsOptions due to change in go-github library
  • Fixed failing tests TestAccGithubRepositoryDeployKey_basic
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v  -timeout 120m
?       github.com/terraform-providers/terraform-provider-github        [no test files]
=== RUN   TestAccGithubTeamDataSource_noMatchReturnsError
--- PASS: TestAccGithubTeamDataSource_noMatchReturnsError (0.30s)
=== RUN   TestAccGithubUserDataSource_noMatchReturnsError
--- PASS: TestAccGithubUserDataSource_noMatchReturnsError (0.08s)
=== RUN   TestAccGithubUserDataSource_existing
--- PASS: TestAccGithubUserDataSource_existing (1.33s)
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccGithubBranchProtection_basic
--- PASS: TestAccGithubBranchProtection_basic (4.73s)
=== RUN   TestAccGithubBranchProtection_emptyItems
--- PASS: TestAccGithubBranchProtection_emptyItems (2.84s)
=== RUN   TestAccGithubBranchProtection_importBasic
--- PASS: TestAccGithubBranchProtection_importBasic (3.30s)
=== RUN   TestAccGithubIssueLabel_basic
--- PASS: TestAccGithubIssueLabel_basic (13.91s)
=== RUN   TestAccGithubIssueLabel_existingLabel
--- PASS: TestAccGithubIssueLabel_existingLabel (2.14s)
=== RUN   TestAccGithubIssueLabel_importBasic
--- PASS: TestAccGithubIssueLabel_importBasic (2.68s)
=== RUN   TestAccGithubMembership_basic
--- PASS: TestAccGithubMembership_basic (1.19s)
=== RUN   TestAccGithubMembership_importBasic
--- PASS: TestAccGithubMembership_importBasic (1.27s)
=== RUN   TestAccGithubOrganizationWebhook_basic
--- PASS: TestAccGithubOrganizationWebhook_basic (1.13s)
=== RUN   TestAccGithubRepositoryCollaborator_basic
--- PASS: TestAccGithubRepositoryCollaborator_basic (2.53s)
=== RUN   TestAccGithubRepositoryCollaborator_importBasic
--- PASS: TestAccGithubRepositoryCollaborator_importBasic (2.46s)
=== RUN   TestAccGithubRepositoryDeployKey_basic
--- PASS: TestAccGithubRepositoryDeployKey_basic (2.44s)
=== RUN   TestAccGithubRepositoryDeployKey_importBasic
--- PASS: TestAccGithubRepositoryDeployKey_importBasic (2.65s)
=== RUN   TestAccGithubRepository_basic
--- PASS: TestAccGithubRepository_basic (2.57s)
=== RUN   TestAccGithubRepository_importBasic
--- PASS: TestAccGithubRepository_importBasic (1.75s)
=== RUN   TestAccGithubRepository_defaultBranch
--- PASS: TestAccGithubRepository_defaultBranch (4.55s)
=== RUN   TestAccGithubRepository_templates
--- PASS: TestAccGithubRepository_templates (2.44s)
=== RUN   TestAccGithubRepositoryWebhook_basic
--- PASS: TestAccGithubRepositoryWebhook_basic (3.34s)
=== RUN   TestAccGithubRepositoryWebhook_importBasic
--- PASS: TestAccGithubRepositoryWebhook_importBasic (2.71s)
=== RUN   TestAccGithubTeamMembership_basic
--- PASS: TestAccGithubTeamMembership_basic (3.39s)
=== RUN   TestAccGithubTeamMembership_importBasic
--- PASS: TestAccGithubTeamMembership_importBasic (21.68s)
=== RUN   TestAccGithubTeamRepository_basic
--- PASS: TestAccGithubTeamRepository_basic (2.97s)
=== RUN   TestAccGithubTeamRepository_importBasic
--- PASS: TestAccGithubTeamRepository_importBasic (2.24s)
=== RUN   TestAccCheckGetPermissions
--- PASS: TestAccCheckGetPermissions (0.00s)
=== RUN   TestAccGithubTeam_basic
--- PASS: TestAccGithubTeam_basic (1.62s)
=== RUN   TestAccGithubTeam_importBasic
--- PASS: TestAccGithubTeam_importBasic (0.72s)
=== RUN   TestAccGithubUtilRole_validation
--- PASS: TestAccGithubUtilRole_validation (0.00s)
=== RUN   TestAccGithubUtilTwoPartID
--- PASS: TestAccGithubUtilTwoPartID (0.00s)
PASS
ok      github.com/terraform-providers/terraform-provider-github/github 94.965s

@denniswebb denniswebb changed the title [WIP] adding require_code_owners_review to github_branch_protection adding require_code_owners_review to github_branch_protection Oct 17, 2017

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

Hi @denniswebb
do you mind submitting all /vendor changes in a separate PR to make review of this one easier by lowering LOC in the diff?

Thanks.

@denniswebb

Copy link
Copy Markdown
Contributor Author

@radeksimko done. I can rebase this onto master after #60 is merged to allow travis to pass.

@denniswebb

denniswebb commented Nov 8, 2017 •

Copy link
Copy Markdown
Contributor Author

@radeksimko Rebased and passing now.

@denniswebb

Copy link
Copy Markdown
Contributor Author

@radeksimko Sorry to ping you on this, just hoping to start using it soon.

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

Hi @denniswebb
thanks for the PR and sorry for the delay in reviewing it.

I just left you one comment there which needs addressing before we can merge it. Otherwise it's good.


if protectionRequest.RequiredPullRequestReviews == nil {
_, err = client.Repositories.RemovePullRequestReviewEnforcement(context.TODO(), meta.(*Organization).name, r, b)
}

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.

Thanks, this will fix the failing TestAccGithubBranchProtection_basic 👍
I just think we're missing an error check here 👓

@thomasbrezinski

Copy link
Copy Markdown

hey @denniswebb , thanks for putting this together! Any chance we could push this along? I'd really like to use this functionality for an upcoming presentation

@docwhat

docwhat commented Jan 31, 2018

Copy link
Copy Markdown
Contributor

@denniswebb Do you have time to do this, or should someone else make the last change?

@denniswebb

Copy link
Copy Markdown
Contributor Author

@radeksimko Fixed, rebased, and pushed. Sorry I overlooked the email. You should've had Brent yell at me.

@radeksimko radeksimko changed the title adding require_code_owners_review to github_branch_protection resource/github_branch_protection: Add support for require_code_owners_review Feb 15, 2018

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

LGTM, thanks

@radeksimko
radeksimko merged commit c530ed0 into integrations:master Feb 15, 2018
@denniswebb
denniswebb deleted the require-code-owners-review branch February 19, 2018 15:44
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
mataiwilson pushed a commit to timja/terraform-provider-github that referenced this pull request Sep 17, 2026
mataiwilson pushed a commit to timja/terraform-provider-github that referenced this pull request Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for "require review from code owners"

4 participants