From f643c0f3fab9235ece313e9b935ae9136d2bb5ab Mon Sep 17 00:00:00 2001 From: Hasnae Rehioui Date: Sat, 4 Nov 2023 02:07:43 +1100 Subject: [PATCH] Fix branch protection request fields (#2977) Fixes: #2976. --- github/repos.go | 2 +- github/repos_test.go | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/github/repos.go b/github/repos.go index e158562e69d..b16cd3b8159 100644 --- a/github/repos.go +++ b/github/repos.go @@ -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"` } diff --git a/github/repos_test.go b/github/repos_test.go index 7486e488fe6..2bdc1b4289d 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -1766,7 +1766,6 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) input := &ProtectionRequest{ RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, - Checks: []*RequiredStatusCheck{}, }, RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ DismissStaleReviews: true, @@ -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":{ @@ -1847,7 +1845,6 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, Contexts: []string{}, - Checks: []*RequiredStatusCheck{}, }, RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ DismissStaleReviews: true,