diff --git a/github/github-accessors.go b/github/github-accessors.go index a01036de23..0d9db6ff89 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -13670,6 +13670,14 @@ func (p *PullRequestReviewsEnforcementUpdate) GetRequireCodeOwnerReviews() bool return *p.RequireCodeOwnerReviews } +// GetRequireLastPushApproval returns the RequireLastPushApproval field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewsEnforcementUpdate) GetRequireLastPushApproval() bool { + if p == nil || p.RequireLastPushApproval == nil { + return false + } + return *p.RequireLastPushApproval +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (p *PullRequestReviewThreadEvent) GetAction() string { if p == nil || p.Action == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 78e862892f..bd2b95dea8 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -15873,6 +15873,16 @@ func TestPullRequestReviewsEnforcementUpdate_GetRequireCodeOwnerReviews(tt *test p.GetRequireCodeOwnerReviews() } +func TestPullRequestReviewsEnforcementUpdate_GetRequireLastPushApproval(tt *testing.T) { + var zeroValue bool + p := &PullRequestReviewsEnforcementUpdate{RequireLastPushApproval: &zeroValue} + p.GetRequireLastPushApproval() + p = &PullRequestReviewsEnforcementUpdate{} + p.GetRequireLastPushApproval() + p = nil + p.GetRequireLastPushApproval() +} + func TestPullRequestReviewThreadEvent_GetAction(tt *testing.T) { var zeroValue string p := &PullRequestReviewThreadEvent{Action: &zeroValue} diff --git a/github/repos.go b/github/repos.go index e12cff0837..9364e8d69f 100644 --- a/github/repos.go +++ b/github/repos.go @@ -1028,6 +1028,8 @@ type PullRequestReviewsEnforcement struct { // 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"` + // RequireLastPushApproval specifies whether the last pusher to a pull request branch can approve it. + RequireLastPushApproval bool `json:"require_last_push_approval"` } // PullRequestReviewsEnforcementRequest represents request to set the pull request review @@ -1064,6 +1066,8 @@ type PullRequestReviewsEnforcementUpdate struct { // RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged. // Valid values are 1 - 6 or 0 to not require reviewers. RequiredApprovingReviewCount int `json:"required_approving_review_count"` + // RequireLastPushApproval specifies whether the last pusher to a pull request branch can approve it. + RequireLastPushApproval *bool `json:"require_last_push_approval,omitempty"` } // RequireLinearHistory represents the configuration to enforce branches with no merge commit.