diff --git a/github/github-accessors.go b/github/github-accessors.go index 2cc8ce0d561..33de4b7e6a0 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -12254,6 +12254,14 @@ func (p *Protection) GetAllowForcePushes() *AllowForcePushes { return p.AllowForcePushes } +// GetAllowForkSyncing returns the AllowForkSyncing field if it's non-nil, zero value otherwise. +func (p *Protection) GetAllowForkSyncing() bool { + if p == nil || p.AllowForkSyncing == nil { + return false + } + return *p.AllowForkSyncing +} + // GetEnforceAdmins returns the EnforceAdmins field. func (p *Protection) GetEnforceAdmins() *AdminEnforcement { if p == nil { @@ -12262,6 +12270,14 @@ func (p *Protection) GetEnforceAdmins() *AdminEnforcement { return p.EnforceAdmins } +// GetLockBranch returns the LockBranch field if it's non-nil, zero value otherwise. +func (p *Protection) GetLockBranch() bool { + if p == nil || p.LockBranch == nil { + return false + } + return *p.LockBranch +} + // GetRequiredConversationResolution returns the RequiredConversationResolution field. func (p *Protection) GetRequiredConversationResolution() *RequiredConversationResolution { if p == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c0565725961..ecc0d7611bb 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -14310,6 +14310,16 @@ func TestProtection_GetAllowForcePushes(tt *testing.T) { p.GetAllowForcePushes() } +func TestProtection_GetAllowForkSyncing(tt *testing.T) { + var zeroValue bool + p := &Protection{AllowForkSyncing: &zeroValue} + p.GetAllowForkSyncing() + p = &Protection{} + p.GetAllowForkSyncing() + p = nil + p.GetAllowForkSyncing() +} + func TestProtection_GetEnforceAdmins(tt *testing.T) { p := &Protection{} p.GetEnforceAdmins() @@ -14317,6 +14327,16 @@ func TestProtection_GetEnforceAdmins(tt *testing.T) { p.GetEnforceAdmins() } +func TestProtection_GetLockBranch(tt *testing.T) { + var zeroValue bool + p := &Protection{LockBranch: &zeroValue} + p.GetLockBranch() + p = &Protection{} + p.GetLockBranch() + p = nil + p.GetLockBranch() +} + func TestProtection_GetRequiredConversationResolution(tt *testing.T) { p := &Protection{} p.GetRequiredConversationResolution() diff --git a/github/repos.go b/github/repos.go index 9364e8d69f7..2b1a263f0f0 100644 --- a/github/repos.go +++ b/github/repos.go @@ -840,6 +840,10 @@ type Protection struct { AllowForcePushes *AllowForcePushes `json:"allow_force_pushes"` AllowDeletions *AllowDeletions `json:"allow_deletions"` RequiredConversationResolution *RequiredConversationResolution `json:"required_conversation_resolution"` + // LockBranch represents if the branch is marked as read-only. If this is true, users will not be able to push to the branch. + LockBranch *bool `json:"lock_branch,omitempty"` + // AllowForkSyncing represents whether users can pull changes from upstream when the branch is locked. + AllowForkSyncing *bool `json:"allow_fork_syncing,omitempty"` } // BranchProtectionRule represents the rule applied to a repositories branch.