diff --git a/github/github-accessors.go b/github/github-accessors.go index a33c1b982a..78a184e6c8 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 { @@ -6934,14 +6942,6 @@ func (e *Environment) GetOwner() string { return *e.Owner } -// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. -func (e *Environment) GetPreventSelfReview() bool { - if e == nil || e.PreventSelfReview == nil { - return false - } - return *e.PreventSelfReview -} - // GetRepo returns the Repo field if it's non-nil, zero value otherwise. func (e *Environment) GetRepo() string { if e == nil || e.Repo == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index bf497da6e8..54c89eb987 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} @@ -8128,16 +8138,6 @@ func TestEnvironment_GetOwner(tt *testing.T) { e.GetOwner() } -func TestEnvironment_GetPreventSelfReview(tt *testing.T) { - var zeroValue bool - e := &Environment{PreventSelfReview: &zeroValue} - e.GetPreventSelfReview() - e = &Environment{} - e.GetPreventSelfReview() - e = nil - e.GetPreventSelfReview() -} - func TestEnvironment_GetRepo(tt *testing.T) { var zeroValue string e := &Environment{Repo: &zeroValue} diff --git a/github/repos_environments.go b/github/repos_environments.go index 68f5626b96..e22ca5cd1b 100644 --- a/github/repos_environments.go +++ b/github/repos_environments.go @@ -17,7 +17,6 @@ type Environment struct { Owner *string `json:"owner,omitempty"` Repo *string `json:"repo,omitempty"` EnvironmentName *string `json:"environment_name,omitempty"` - PreventSelfReview *bool `json:"prevent_self_review,omitempty"` WaitTimer *int `json:"wait_timer,omitempty"` Reviewers []*EnvReviewers `json:"reviewers,omitempty"` DeploymentBranchPolicy *BranchPolicy `json:"deployment_branch_policy,omitempty"` @@ -175,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.