Skip to content

Commit be31e40

Browse files
authored
Added RequiredConversationResolution protection field (#1946)
Fixes: #1945.
1 parent 0f0b9a5 commit be31e40

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

github/github-accessors.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/repos.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -754,13 +754,14 @@ type Branch struct {
754754

755755
// Protection represents a repository branch's protection.
756756
type Protection struct {
757-
RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
758-
RequiredPullRequestReviews *PullRequestReviewsEnforcement `json:"required_pull_request_reviews"`
759-
EnforceAdmins *AdminEnforcement `json:"enforce_admins"`
760-
Restrictions *BranchRestrictions `json:"restrictions"`
761-
RequireLinearHistory *RequireLinearHistory `json:"required_linear_history"`
762-
AllowForcePushes *AllowForcePushes `json:"allow_force_pushes"`
763-
AllowDeletions *AllowDeletions `json:"allow_deletions"`
757+
RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
758+
RequiredPullRequestReviews *PullRequestReviewsEnforcement `json:"required_pull_request_reviews"`
759+
EnforceAdmins *AdminEnforcement `json:"enforce_admins"`
760+
Restrictions *BranchRestrictions `json:"restrictions"`
761+
RequireLinearHistory *RequireLinearHistory `json:"required_linear_history"`
762+
AllowForcePushes *AllowForcePushes `json:"allow_force_pushes"`
763+
AllowDeletions *AllowDeletions `json:"allow_deletions"`
764+
RequiredConversationResolution *RequiredConversationResolution `json:"required_conversation_resolution"`
764765
}
765766

766767
// ProtectionRequest represents a request to create/edit a branch's protection.
@@ -852,6 +853,11 @@ type AllowForcePushes struct {
852853
Enabled bool `json:"enabled"`
853854
}
854855

856+
// RequiredConversationResolution, if enabled, requires all comments on the pull request to be resolved before it can be merged to a protected branch.
857+
type RequiredConversationResolution struct {
858+
Enabled bool `json:"enabled"`
859+
}
860+
855861
// AdminEnforcement represents the configuration to enforce required status checks for repository administrators.
856862
type AdminEnforcement struct {
857863
URL *string `json:"url,omitempty"`

github/repos_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,9 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) {
10191019
"restrictions":{
10201020
"users":[{"id":1,"login":"u"}],
10211021
"teams":[{"id":2,"slug":"t"}]
1022+
},
1023+
"required_conversation_resolution": {
1024+
"enabled": true
10221025
}
10231026
}`)
10241027
})
@@ -1059,6 +1062,9 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) {
10591062
{Slug: String("t"), ID: Int64(2)},
10601063
},
10611064
},
1065+
RequiredConversationResolution: &RequiredConversationResolution{
1066+
Enabled: true,
1067+
},
10621068
}
10631069
if !cmp.Equal(protection, want) {
10641070
t.Errorf("Repositories.GetBranchProtection returned %+v, want %+v", protection, want)

0 commit comments

Comments
 (0)