diff --git a/github/github-accessors.go b/github/github-accessors.go index a0e7a74366e..78a184e6c80 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4838,6 +4838,14 @@ func (c *CreateUpdateEnvironment) GetDeploymentBranchPolicy() *BranchPolicy { return c.DeploymentBranchPolicy } +// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. +func (c *CreateUpdateEnvironment) GetPreventSelfReview() bool { + if c == nil || c.PreventSelfReview == nil { + return false + } + return *c.PreventSelfReview +} + // GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. func (c *CreateUpdateEnvironment) GetWaitTimer() int { if c == nil || c.WaitTimer == nil { @@ -15534,6 +15542,14 @@ func (p *ProtectionRule) GetNodeID() string { return *p.NodeID } +// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. +func (p *ProtectionRule) GetPreventSelfReview() bool { + if p == nil || p.PreventSelfReview == nil { + return false + } + return *p.PreventSelfReview +} + // GetType returns the Type field if it's non-nil, zero value otherwise. func (p *ProtectionRule) GetType() string { if p == nil || p.Type == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 9b3c36fd9bc..54c89eb9876 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5712,6 +5712,16 @@ func TestCreateUpdateEnvironment_GetDeploymentBranchPolicy(tt *testing.T) { c.GetDeploymentBranchPolicy() } +func TestCreateUpdateEnvironment_GetPreventSelfReview(tt *testing.T) { + var zeroValue bool + c := &CreateUpdateEnvironment{PreventSelfReview: &zeroValue} + c.GetPreventSelfReview() + c = &CreateUpdateEnvironment{} + c.GetPreventSelfReview() + c = nil + c.GetPreventSelfReview() +} + func TestCreateUpdateEnvironment_GetWaitTimer(tt *testing.T) { var zeroValue int c := &CreateUpdateEnvironment{WaitTimer: &zeroValue} @@ -18047,6 +18057,16 @@ func TestProtectionRule_GetNodeID(tt *testing.T) { p.GetNodeID() } +func TestProtectionRule_GetPreventSelfReview(tt *testing.T) { + var zeroValue bool + p := &ProtectionRule{PreventSelfReview: &zeroValue} + p.GetPreventSelfReview() + p = &ProtectionRule{} + p.GetPreventSelfReview() + p = nil + p.GetPreventSelfReview() +} + func TestProtectionRule_GetType(tt *testing.T) { var zeroValue string p := &ProtectionRule{Type: &zeroValue} diff --git a/github/repos_environments.go b/github/repos_environments.go index 2399a42c746..e22ca5cd1be 100644 --- a/github/repos_environments.go +++ b/github/repos_environments.go @@ -52,11 +52,12 @@ type EnvResponse struct { // ProtectionRule represents a single protection rule applied to the environment. type ProtectionRule struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Type *string `json:"type,omitempty"` - WaitTimer *int `json:"wait_timer,omitempty"` - Reviewers []*RequiredReviewer `json:"reviewers,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + PreventSelfReview *bool `json:"prevent_self_review,omitempty"` + Type *string `json:"type,omitempty"` + WaitTimer *int `json:"wait_timer,omitempty"` + Reviewers []*RequiredReviewer `json:"reviewers,omitempty"` } // RequiredReviewer represents a required reviewer. @@ -173,6 +174,7 @@ type CreateUpdateEnvironment struct { Reviewers []*EnvReviewers `json:"reviewers"` CanAdminsBypass *bool `json:"can_admins_bypass"` DeploymentBranchPolicy *BranchPolicy `json:"deployment_branch_policy"` + PreventSelfReview *bool `json:"prevent_self_review,omitempty"` } // createUpdateEnvironmentNoEnterprise represents the fields accepted for Pro/Teams private repos.