From 57e3a08c68fce8630e901a2a3364ab24f1391059 Mon Sep 17 00:00:00 2001 From: OrlovM Date: Fri, 9 Jul 2021 16:55:01 +0300 Subject: [PATCH] Added RequiredConversationResolution ProtectionRequest field --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ github/repos.go | 3 +++ 3 files changed, 21 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 46efcc9c425..d5216f52590 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -10052,6 +10052,14 @@ func (p *ProtectionRequest) GetAllowForcePushes() bool { return *p.AllowForcePushes } +// GetRequiredConversationResolution returns the RequiredConversationResolution field if it's non-nil, zero value otherwise. +func (p *ProtectionRequest) GetRequiredConversationResolution() bool { + if p == nil || p.RequiredConversationResolution == nil { + return false + } + return *p.RequiredConversationResolution +} + // GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field. func (p *ProtectionRequest) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcementRequest { if p == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 4fcdd919208..b63e9709e48 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -11735,6 +11735,16 @@ func TestProtectionRequest_GetAllowForcePushes(tt *testing.T) { p.GetAllowForcePushes() } +func TestProtectionRequest_GetRequiredConversationResolution(tt *testing.T) { + var zeroValue bool + p := &ProtectionRequest{RequiredConversationResolution: &zeroValue} + p.GetRequiredConversationResolution() + p = &ProtectionRequest{} + p.GetRequiredConversationResolution() + p = nil + p.GetRequiredConversationResolution() +} + func TestProtectionRequest_GetRequiredPullRequestReviews(tt *testing.T) { p := &ProtectionRequest{} p.GetRequiredPullRequestReviews() diff --git a/github/repos.go b/github/repos.go index d336e8bf773..eaadbb43753 100644 --- a/github/repos.go +++ b/github/repos.go @@ -776,6 +776,9 @@ type ProtectionRequest struct { AllowForcePushes *bool `json:"allow_force_pushes,omitempty"` // Allows deletion of the protected branch by anyone with write access to the repository. AllowDeletions *bool `json:"allow_deletions,omitempty"` + // RequiredConversationResolution, if set to true, requires all comments + // on the pull request to be resolved before it can be merged to a protected branch. + RequiredConversationResolution *bool `json:"required_conversation_resolution,omitempty"` } // RequiredStatusChecks represents the protection status of a individual branch.