From 97e51e386759b7aeabb5a9f3b9d3f904d814439e Mon Sep 17 00:00:00 2001 From: JamBalaya56562 Date: Sun, 3 May 2026 05:22:16 +0900 Subject: [PATCH] feat: Add deploy_keys_enabled_for_repositories and secret scanning custom link fields to Organization struct --- github/github-accessors.go | 24 ++++++++++++++++++++++++ github/github-accessors_test.go | 33 +++++++++++++++++++++++++++++++++ github/github-stringify_test.go | 5 ++++- github/orgs.go | 7 +++++++ 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 62039ba8fd3..c73325cf6e5 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -22950,6 +22950,14 @@ func (o *Organization) GetDependencyGraphEnabledForNewRepos() bool { return *o.DependencyGraphEnabledForNewRepos } +// GetDeployKeysEnabledForRepositories returns the DeployKeysEnabledForRepositories field if it's non-nil, zero value otherwise. +func (o *Organization) GetDeployKeysEnabledForRepositories() bool { + if o == nil || o.DeployKeysEnabledForRepositories == nil { + return false + } + return *o.DeployKeysEnabledForRepositories +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (o *Organization) GetDescription() string { if o == nil || o.Description == nil { @@ -23294,6 +23302,22 @@ func (o *Organization) GetSecretScanningEnabledForNewRepos() bool { return *o.SecretScanningEnabledForNewRepos } +// GetSecretScanningPushProtectionCustomLink returns the SecretScanningPushProtectionCustomLink field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningPushProtectionCustomLink() string { + if o == nil || o.SecretScanningPushProtectionCustomLink == nil { + return "" + } + return *o.SecretScanningPushProtectionCustomLink +} + +// GetSecretScanningPushProtectionCustomLinkEnabled returns the SecretScanningPushProtectionCustomLinkEnabled field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningPushProtectionCustomLinkEnabled() bool { + if o == nil || o.SecretScanningPushProtectionCustomLinkEnabled == nil { + return false + } + return *o.SecretScanningPushProtectionCustomLinkEnabled +} + // GetSecretScanningPushProtectionEnabledForNewRepos returns the SecretScanningPushProtectionEnabledForNewRepos field if it's non-nil, zero value otherwise. func (o *Organization) GetSecretScanningPushProtectionEnabledForNewRepos() bool { if o == nil || o.SecretScanningPushProtectionEnabledForNewRepos == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 217edb33363..e00df0b29b7 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -28936,6 +28936,17 @@ func TestOrganization_GetDependencyGraphEnabledForNewRepos(tt *testing.T) { o.GetDependencyGraphEnabledForNewRepos() } +func TestOrganization_GetDeployKeysEnabledForRepositories(tt *testing.T) { + tt.Parallel() + var zeroValue bool + o := &Organization{DeployKeysEnabledForRepositories: &zeroValue} + o.GetDeployKeysEnabledForRepositories() + o = &Organization{} + o.GetDeployKeysEnabledForRepositories() + o = nil + o.GetDeployKeysEnabledForRepositories() +} + func TestOrganization_GetDescription(tt *testing.T) { tt.Parallel() var zeroValue string @@ -29406,6 +29417,28 @@ func TestOrganization_GetSecretScanningEnabledForNewRepos(tt *testing.T) { o.GetSecretScanningEnabledForNewRepos() } +func TestOrganization_GetSecretScanningPushProtectionCustomLink(tt *testing.T) { + tt.Parallel() + var zeroValue string + o := &Organization{SecretScanningPushProtectionCustomLink: &zeroValue} + o.GetSecretScanningPushProtectionCustomLink() + o = &Organization{} + o.GetSecretScanningPushProtectionCustomLink() + o = nil + o.GetSecretScanningPushProtectionCustomLink() +} + +func TestOrganization_GetSecretScanningPushProtectionCustomLinkEnabled(tt *testing.T) { + tt.Parallel() + var zeroValue bool + o := &Organization{SecretScanningPushProtectionCustomLinkEnabled: &zeroValue} + o.GetSecretScanningPushProtectionCustomLinkEnabled() + o = &Organization{} + o.GetSecretScanningPushProtectionCustomLinkEnabled() + o = nil + o.GetSecretScanningPushProtectionCustomLinkEnabled() +} + func TestOrganization_GetSecretScanningPushProtectionEnabledForNewRepos(tt *testing.T) { tt.Parallel() var zeroValue bool diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 80e30da9d28..aa1d905a2e4 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1256,6 +1256,7 @@ func TestOrganization_String(t *testing.T) { MembersCanCreatePrivateRepos: Ptr(false), MembersCanCreateInternalRepos: Ptr(false), MembersCanForkPrivateRepos: Ptr(false), + DeployKeysEnabledForRepositories: Ptr(false), MembersAllowedRepositoryCreationType: Ptr(""), MembersCanCreatePages: Ptr(false), MembersCanCreatePublicPages: Ptr(false), @@ -1268,6 +1269,8 @@ func TestOrganization_String(t *testing.T) { SecretScanningEnabledForNewRepos: Ptr(false), SecretScanningPushProtectionEnabledForNewRepos: Ptr(false), SecretScanningValidityChecksEnabled: Ptr(false), + SecretScanningPushProtectionCustomLinkEnabled: Ptr(false), + SecretScanningPushProtectionCustomLink: Ptr(""), MembersCanDeleteRepositories: Ptr(false), MembersCanChangeRepoVisibility: Ptr(false), MembersCanInviteOutsideCollaborators: Ptr(false), @@ -1285,7 +1288,7 @@ func TestOrganization_String(t *testing.T) { PublicMembersURL: Ptr(""), ReposURL: Ptr(""), } - want := `github.Organization{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", Name:"", Company:"", Blog:"", Location:"", Email:"", TwitterUsername:"", Description:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ArchivedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, BillingEmail:"", Type:"", Plan:github.Plan{}, TwoFactorRequirementEnabled:false, IsVerified:false, HasOrganizationProjects:false, HasRepositoryProjects:false, DefaultRepoPermission:"", DefaultRepoSettings:"", MembersCanCreateRepos:false, MembersCanCreatePublicRepos:false, MembersCanCreatePrivateRepos:false, MembersCanCreateInternalRepos:false, MembersCanForkPrivateRepos:false, MembersAllowedRepositoryCreationType:"", MembersCanCreatePages:false, MembersCanCreatePublicPages:false, MembersCanCreatePrivatePages:false, WebCommitSignoffRequired:false, AdvancedSecurityEnabledForNewRepos:false, DependabotAlertsEnabledForNewRepos:false, DependabotSecurityUpdatesEnabledForNewRepos:false, DependencyGraphEnabledForNewRepos:false, SecretScanningEnabledForNewRepos:false, SecretScanningPushProtectionEnabledForNewRepos:false, SecretScanningValidityChecksEnabled:false, MembersCanDeleteRepositories:false, MembersCanChangeRepoVisibility:false, MembersCanInviteOutsideCollaborators:false, MembersCanDeleteIssues:false, DisplayCommenterFullNameSettingEnabled:false, ReadersCanCreateDiscussions:false, MembersCanCreateTeams:false, MembersCanViewDependencyInsights:false, DefaultRepositoryBranch:"", URL:"", EventsURL:"", HooksURL:"", IssuesURL:"", MembersURL:"", PublicMembersURL:"", ReposURL:""}` + want := `github.Organization{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", Name:"", Company:"", Blog:"", Location:"", Email:"", TwitterUsername:"", Description:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ArchivedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, BillingEmail:"", Type:"", Plan:github.Plan{}, TwoFactorRequirementEnabled:false, IsVerified:false, HasOrganizationProjects:false, HasRepositoryProjects:false, DefaultRepoPermission:"", DefaultRepoSettings:"", MembersCanCreateRepos:false, MembersCanCreatePublicRepos:false, MembersCanCreatePrivateRepos:false, MembersCanCreateInternalRepos:false, MembersCanForkPrivateRepos:false, DeployKeysEnabledForRepositories:false, MembersAllowedRepositoryCreationType:"", MembersCanCreatePages:false, MembersCanCreatePublicPages:false, MembersCanCreatePrivatePages:false, WebCommitSignoffRequired:false, AdvancedSecurityEnabledForNewRepos:false, DependabotAlertsEnabledForNewRepos:false, DependabotSecurityUpdatesEnabledForNewRepos:false, DependencyGraphEnabledForNewRepos:false, SecretScanningEnabledForNewRepos:false, SecretScanningPushProtectionEnabledForNewRepos:false, SecretScanningValidityChecksEnabled:false, SecretScanningPushProtectionCustomLinkEnabled:false, SecretScanningPushProtectionCustomLink:"", MembersCanDeleteRepositories:false, MembersCanChangeRepoVisibility:false, MembersCanInviteOutsideCollaborators:false, MembersCanDeleteIssues:false, DisplayCommenterFullNameSettingEnabled:false, ReadersCanCreateDiscussions:false, MembersCanCreateTeams:false, MembersCanViewDependencyInsights:false, DefaultRepositoryBranch:"", URL:"", EventsURL:"", HooksURL:"", IssuesURL:"", MembersURL:"", PublicMembersURL:"", ReposURL:""}` if got := v.String(); got != want { t.Errorf("Organization.String = %v, want %v", got, want) } diff --git a/github/orgs.go b/github/orgs.go index 67073875c90..d577b98b61a 100644 --- a/github/orgs.go +++ b/github/orgs.go @@ -68,6 +68,9 @@ type Organization struct { // MembersCanForkPrivateRepos toggles whether organization members can fork private organization repositories. MembersCanForkPrivateRepos *bool `json:"members_can_fork_private_repositories,omitempty"` + // DeployKeysEnabledForRepositories toggles whether deploy keys may be added and used for repositories in the organization. + DeployKeysEnabledForRepositories *bool `json:"deploy_keys_enabled_for_repositories,omitempty"` + // MembersAllowedRepositoryCreationType denotes if organization members can create repositories // and the type of repositories they can create. Possible values are: "all", "private", or "none". // @@ -98,6 +101,10 @@ type Organization struct { SecretScanningPushProtectionEnabledForNewRepos *bool `json:"secret_scanning_push_protection_enabled_for_new_repositories,omitempty"` // SecretScanningValidityChecksEnabled toggles whether secret scanning validity check is enabled. SecretScanningValidityChecksEnabled *bool `json:"secret_scanning_validity_checks_enabled,omitempty"` + // SecretScanningPushProtectionCustomLinkEnabled toggles whether a custom link is shown to contributors blocked by secret scanning push protection. + SecretScanningPushProtectionCustomLinkEnabled *bool `json:"secret_scanning_push_protection_custom_link_enabled,omitempty"` + // SecretScanningPushProtectionCustomLink is the URL displayed to contributors blocked by secret scanning push protection. + SecretScanningPushProtectionCustomLink *string `json:"secret_scanning_push_protection_custom_link,omitempty"` // MembersCanDeleteRepositories toggles whether members with admin permissions can delete a repository. MembersCanDeleteRepositories *bool `json:"members_can_delete_repositories,omitempty"` // MembersCanChangeRepoVisibility toggles whether members with admin permissions can change the visibility for a repository.