Skip to content

Support preview Protected Branches API #974

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

Closed
wants to merge 14 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions github/repos.go
Original file line number Diff line number Diff line change
@@ -563,11 +563,11 @@ type RequiredStatusChecksRequest struct {
// PullRequestReviewsEnforcement represents the pull request reviews enforcement of a protected branch.
type PullRequestReviewsEnforcement struct {
// Specifies which users and teams can dismiss pull request reviews.
DismissalRestrictions DismissalRestrictions `json:"dismissal_restrictions"`
DismissalRestrictions DismissalRestrictions `json:"dismissal_restrictions,omitempty"`
// Specifies if approved reviews are dismissed automatically, when a new commit is pushed.
DismissStaleReviews bool `json:"dismiss_stale_reviews"`
DismissStaleReviews bool `json:"dismiss_stale_reviews,omitempty"`
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"`
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews,omitempty"`
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged.
// Valid values are 1-6.
RequiredApprovingReviewCount int `json:"required_approving_review_count"`
6 changes: 4 additions & 2 deletions github/repos_test.go
Original file line number Diff line number Diff line change
@@ -656,7 +656,8 @@ func TestRepositoriesService_UpdateBranchProtection(t *testing.T) {
}]
},
"dismiss_stale_reviews":true,
"require_code_owner_reviews":true
"require_code_owner_reviews":true,
"required_approving_review_count":2
},
"restrictions":{
"users":[{"id":1,"login":"u"}],
@@ -685,7 +686,8 @@ func TestRepositoriesService_UpdateBranchProtection(t *testing.T) {
{Slug: String("tt"), ID: Int64(4)},
},
},
RequireCodeOwnerReviews: true,
RequireCodeOwnerReviews: true,
RequiredApprovingReviewCount: 2,
},
Restrictions: &BranchRestrictions{
Users: []*User{