Skip to content

Commit

Permalink
Fix branch protection request fields (google#2977)
Browse files Browse the repository at this point in the history
Fixes: google#2976.
  • Loading branch information
viqueen authored Nov 3, 2023
1 parent a54bc7d commit f643c0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion github/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ type RequiredStatusChecks struct {
Contexts []string `json:"contexts,omitempty"`
// The list of status checks to require in order to merge into this
// branch.
Checks []*RequiredStatusCheck `json:"checks"`
Checks []*RequiredStatusCheck `json:"checks,omitempty"`
ContextsURL *string `json:"contexts_url,omitempty"`
URL *string `json:"url,omitempty"`
}
Expand Down
5 changes: 1 addition & 4 deletions github/repos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,6 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T)
input := &ProtectionRequest{
RequiredStatusChecks: &RequiredStatusChecks{
Strict: true,
Checks: []*RequiredStatusCheck{},
},
RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{
DismissStaleReviews: true,
Expand Down Expand Up @@ -1802,8 +1801,7 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T)
fmt.Fprintf(w, `{
"required_status_checks":{
"strict":true,
"contexts":[],
"checks": []
"contexts":[]
},
"required_pull_request_reviews":{
"dismissal_restrictions":{
Expand Down Expand Up @@ -1847,7 +1845,6 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T)
RequiredStatusChecks: &RequiredStatusChecks{
Strict: true,
Contexts: []string{},
Checks: []*RequiredStatusCheck{},
},
RequiredPullRequestReviews: &PullRequestReviewsEnforcement{
DismissStaleReviews: true,
Expand Down

0 comments on commit f643c0f

Please sign in to comment.