From 9e5d41501d5ae2a298b8dcb90666bbb650a9698b Mon Sep 17 00:00:00 2001 From: Misha Kushakov Date: Thu, 16 Apr 2026 13:23:56 +0200 Subject: [PATCH 1/6] feat(private-registry): add OIDC support and related fields in private registry models --- github/github-accessors.go | 212 +++++++++++++++++++++- github/github-accessors_test.go | 285 +++++++++++++++++++++++++++++- github/private_registries.go | 99 +++++++++-- github/private_registries_test.go | 54 ++---- 4 files changed, 592 insertions(+), 58 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index f925dff0d29..ad5957d353b 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -9510,20 +9510,92 @@ func (c *CreateHostedRunnerRequest) GetSize() string { return c.Size } -// GetEncryptedValue returns the EncryptedValue field. +// GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAccountID() string { + if c == nil || c.AccountID == nil { + return "" + } + return *c.AccountID +} + +// GetAudience returns the Audience field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAudience() string { + if c == nil || c.Audience == nil { + return "" + } + return *c.Audience +} + +// GetAuthType returns the AuthType field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAuthType() string { + if c == nil || c.AuthType == nil { + return "" + } + return *c.AuthType +} + +// GetAwsRegion returns the AwsRegion field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAwsRegion() string { + if c == nil || c.AwsRegion == nil { + return "" + } + return *c.AwsRegion +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetDomain() string { + if c == nil || c.Domain == nil { + return "" + } + return *c.Domain +} + +// GetDomainOwner returns the DomainOwner field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetDomainOwner() string { + if c == nil || c.DomainOwner == nil { + return "" + } + return *c.DomainOwner +} + +// GetEncryptedValue returns the EncryptedValue field if it's non-nil, zero value otherwise. func (c *CreateOrganizationPrivateRegistry) GetEncryptedValue() string { - if c == nil { + if c == nil || c.EncryptedValue == nil { return "" } - return c.EncryptedValue + return *c.EncryptedValue } -// GetKeyID returns the KeyID field. +// GetIdentityMappingName returns the IdentityMappingName field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetIdentityMappingName() string { + if c == nil || c.IdentityMappingName == nil { + return "" + } + return *c.IdentityMappingName +} + +// GetJfrogOidcProviderName returns the JfrogOidcProviderName field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetJfrogOidcProviderName() string { + if c == nil || c.JfrogOidcProviderName == nil { + return "" + } + return *c.JfrogOidcProviderName +} + +// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. func (c *CreateOrganizationPrivateRegistry) GetKeyID() string { - if c == nil { + if c == nil || c.KeyID == nil { return "" } - return c.KeyID + return *c.KeyID } // GetRegistryType returns the RegistryType field. @@ -9534,6 +9606,22 @@ func (c *CreateOrganizationPrivateRegistry) GetRegistryType() string { return c.RegistryType } +// GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetReplacesBase() bool { + if c == nil || c.ReplacesBase == nil { + return false + } + return *c.ReplacesBase +} + +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetRoleName() string { + if c == nil || c.RoleName == nil { + return "" + } + return *c.RoleName +} + // GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. func (c *CreateOrganizationPrivateRegistry) GetSelectedRepositoryIDs() []int64 { if c == nil || c.SelectedRepositoryIDs == nil { @@ -9542,6 +9630,14 @@ func (c *CreateOrganizationPrivateRegistry) GetSelectedRepositoryIDs() []int64 { return c.SelectedRepositoryIDs } +// GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetTenantID() string { + if c == nil || c.TenantID == nil { + return "" + } + return *c.TenantID +} + // GetURL returns the URL field. func (c *CreateOrganizationPrivateRegistry) GetURL() string { if c == nil { @@ -26038,6 +26134,14 @@ func (p *PrivateRegistry) GetRegistryType() string { return *p.RegistryType } +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (p *PrivateRegistry) GetSelectedRepositoryIDs() []int64 { + if p == nil || p.SelectedRepositoryIDs == nil { + return nil + } + return p.SelectedRepositoryIDs +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (p *PrivateRegistry) GetUpdatedAt() Timestamp { if p == nil || p.UpdatedAt == nil { @@ -39630,6 +39734,62 @@ func (u *UpdateHostedRunnerRequest) GetSize() string { return *u.Size } +// GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAccountID() string { + if u == nil || u.AccountID == nil { + return "" + } + return *u.AccountID +} + +// GetAudience returns the Audience field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAudience() string { + if u == nil || u.Audience == nil { + return "" + } + return *u.Audience +} + +// GetAuthType returns the AuthType field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAuthType() string { + if u == nil || u.AuthType == nil { + return "" + } + return *u.AuthType +} + +// GetAwsRegion returns the AwsRegion field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAwsRegion() string { + if u == nil || u.AwsRegion == nil { + return "" + } + return *u.AwsRegion +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetClientID() string { + if u == nil || u.ClientID == nil { + return "" + } + return *u.ClientID +} + +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetDomain() string { + if u == nil || u.Domain == nil { + return "" + } + return *u.Domain +} + +// GetDomainOwner returns the DomainOwner field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetDomainOwner() string { + if u == nil || u.DomainOwner == nil { + return "" + } + return *u.DomainOwner +} + // GetEncryptedValue returns the EncryptedValue field if it's non-nil, zero value otherwise. func (u *UpdateOrganizationPrivateRegistry) GetEncryptedValue() string { if u == nil || u.EncryptedValue == nil { @@ -39638,6 +39798,22 @@ func (u *UpdateOrganizationPrivateRegistry) GetEncryptedValue() string { return *u.EncryptedValue } +// GetIdentityMappingName returns the IdentityMappingName field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetIdentityMappingName() string { + if u == nil || u.IdentityMappingName == nil { + return "" + } + return *u.IdentityMappingName +} + +// GetJfrogOidcProviderName returns the JfrogOidcProviderName field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetJfrogOidcProviderName() string { + if u == nil || u.JfrogOidcProviderName == nil { + return "" + } + return *u.JfrogOidcProviderName +} + // GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. func (u *UpdateOrganizationPrivateRegistry) GetKeyID() string { if u == nil || u.KeyID == nil { @@ -39654,6 +39830,22 @@ func (u *UpdateOrganizationPrivateRegistry) GetRegistryType() string { return *u.RegistryType } +// GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetReplacesBase() bool { + if u == nil || u.ReplacesBase == nil { + return false + } + return *u.ReplacesBase +} + +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetRoleName() string { + if u == nil || u.RoleName == nil { + return "" + } + return *u.RoleName +} + // GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. func (u *UpdateOrganizationPrivateRegistry) GetSelectedRepositoryIDs() []int64 { if u == nil || u.SelectedRepositoryIDs == nil { @@ -39662,6 +39854,14 @@ func (u *UpdateOrganizationPrivateRegistry) GetSelectedRepositoryIDs() []int64 { return u.SelectedRepositoryIDs } +// GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetTenantID() string { + if u == nil || u.TenantID == nil { + return "" + } + return *u.TenantID +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (u *UpdateOrganizationPrivateRegistry) GetURL() string { if u == nil || u.URL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 2b556a2ccce..ad1a0e3b7f9 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -12079,17 +12079,122 @@ func TestCreateHostedRunnerRequest_GetSize(tt *testing.T) { c.GetSize() } +func TestCreateOrganizationPrivateRegistry_GetAccountID(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{AccountID: &zeroValue} + c.GetAccountID() + c = &CreateOrganizationPrivateRegistry{} + c.GetAccountID() + c = nil + c.GetAccountID() +} + +func TestCreateOrganizationPrivateRegistry_GetAudience(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{Audience: &zeroValue} + c.GetAudience() + c = &CreateOrganizationPrivateRegistry{} + c.GetAudience() + c = nil + c.GetAudience() +} + +func TestCreateOrganizationPrivateRegistry_GetAuthType(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{AuthType: &zeroValue} + c.GetAuthType() + c = &CreateOrganizationPrivateRegistry{} + c.GetAuthType() + c = nil + c.GetAuthType() +} + +func TestCreateOrganizationPrivateRegistry_GetAwsRegion(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{AwsRegion: &zeroValue} + c.GetAwsRegion() + c = &CreateOrganizationPrivateRegistry{} + c.GetAwsRegion() + c = nil + c.GetAwsRegion() +} + +func TestCreateOrganizationPrivateRegistry_GetClientID(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{ClientID: &zeroValue} + c.GetClientID() + c = &CreateOrganizationPrivateRegistry{} + c.GetClientID() + c = nil + c.GetClientID() +} + +func TestCreateOrganizationPrivateRegistry_GetDomain(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{Domain: &zeroValue} + c.GetDomain() + c = &CreateOrganizationPrivateRegistry{} + c.GetDomain() + c = nil + c.GetDomain() +} + +func TestCreateOrganizationPrivateRegistry_GetDomainOwner(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{DomainOwner: &zeroValue} + c.GetDomainOwner() + c = &CreateOrganizationPrivateRegistry{} + c.GetDomainOwner() + c = nil + c.GetDomainOwner() +} + func TestCreateOrganizationPrivateRegistry_GetEncryptedValue(tt *testing.T) { tt.Parallel() - c := &CreateOrganizationPrivateRegistry{} + var zeroValue string + c := &CreateOrganizationPrivateRegistry{EncryptedValue: &zeroValue} + c.GetEncryptedValue() + c = &CreateOrganizationPrivateRegistry{} c.GetEncryptedValue() c = nil c.GetEncryptedValue() } +func TestCreateOrganizationPrivateRegistry_GetIdentityMappingName(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{IdentityMappingName: &zeroValue} + c.GetIdentityMappingName() + c = &CreateOrganizationPrivateRegistry{} + c.GetIdentityMappingName() + c = nil + c.GetIdentityMappingName() +} + +func TestCreateOrganizationPrivateRegistry_GetJfrogOidcProviderName(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{JfrogOidcProviderName: &zeroValue} + c.GetJfrogOidcProviderName() + c = &CreateOrganizationPrivateRegistry{} + c.GetJfrogOidcProviderName() + c = nil + c.GetJfrogOidcProviderName() +} + func TestCreateOrganizationPrivateRegistry_GetKeyID(tt *testing.T) { tt.Parallel() - c := &CreateOrganizationPrivateRegistry{} + var zeroValue string + c := &CreateOrganizationPrivateRegistry{KeyID: &zeroValue} + c.GetKeyID() + c = &CreateOrganizationPrivateRegistry{} c.GetKeyID() c = nil c.GetKeyID() @@ -12103,6 +12208,28 @@ func TestCreateOrganizationPrivateRegistry_GetRegistryType(tt *testing.T) { c.GetRegistryType() } +func TestCreateOrganizationPrivateRegistry_GetReplacesBase(tt *testing.T) { + tt.Parallel() + var zeroValue bool + c := &CreateOrganizationPrivateRegistry{ReplacesBase: &zeroValue} + c.GetReplacesBase() + c = &CreateOrganizationPrivateRegistry{} + c.GetReplacesBase() + c = nil + c.GetReplacesBase() +} + +func TestCreateOrganizationPrivateRegistry_GetRoleName(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{RoleName: &zeroValue} + c.GetRoleName() + c = &CreateOrganizationPrivateRegistry{} + c.GetRoleName() + c = nil + c.GetRoleName() +} + func TestCreateOrganizationPrivateRegistry_GetSelectedRepositoryIDs(tt *testing.T) { tt.Parallel() zeroValue := []int64{} @@ -12114,6 +12241,17 @@ func TestCreateOrganizationPrivateRegistry_GetSelectedRepositoryIDs(tt *testing. c.GetSelectedRepositoryIDs() } +func TestCreateOrganizationPrivateRegistry_GetTenantID(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateOrganizationPrivateRegistry{TenantID: &zeroValue} + c.GetTenantID() + c = &CreateOrganizationPrivateRegistry{} + c.GetTenantID() + c = nil + c.GetTenantID() +} + func TestCreateOrganizationPrivateRegistry_GetURL(tt *testing.T) { tt.Parallel() c := &CreateOrganizationPrivateRegistry{} @@ -32906,6 +33044,17 @@ func TestPrivateRegistry_GetRegistryType(tt *testing.T) { p.GetRegistryType() } +func TestPrivateRegistry_GetSelectedRepositoryIDs(tt *testing.T) { + tt.Parallel() + zeroValue := []int64{} + p := &PrivateRegistry{SelectedRepositoryIDs: zeroValue} + p.GetSelectedRepositoryIDs() + p = &PrivateRegistry{} + p.GetSelectedRepositoryIDs() + p = nil + p.GetSelectedRepositoryIDs() +} + func TestPrivateRegistry_GetUpdatedAt(tt *testing.T) { tt.Parallel() var zeroValue Timestamp @@ -49810,6 +49959,83 @@ func TestUpdateHostedRunnerRequest_GetSize(tt *testing.T) { u.GetSize() } +func TestUpdateOrganizationPrivateRegistry_GetAccountID(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{AccountID: &zeroValue} + u.GetAccountID() + u = &UpdateOrganizationPrivateRegistry{} + u.GetAccountID() + u = nil + u.GetAccountID() +} + +func TestUpdateOrganizationPrivateRegistry_GetAudience(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{Audience: &zeroValue} + u.GetAudience() + u = &UpdateOrganizationPrivateRegistry{} + u.GetAudience() + u = nil + u.GetAudience() +} + +func TestUpdateOrganizationPrivateRegistry_GetAuthType(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{AuthType: &zeroValue} + u.GetAuthType() + u = &UpdateOrganizationPrivateRegistry{} + u.GetAuthType() + u = nil + u.GetAuthType() +} + +func TestUpdateOrganizationPrivateRegistry_GetAwsRegion(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{AwsRegion: &zeroValue} + u.GetAwsRegion() + u = &UpdateOrganizationPrivateRegistry{} + u.GetAwsRegion() + u = nil + u.GetAwsRegion() +} + +func TestUpdateOrganizationPrivateRegistry_GetClientID(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{ClientID: &zeroValue} + u.GetClientID() + u = &UpdateOrganizationPrivateRegistry{} + u.GetClientID() + u = nil + u.GetClientID() +} + +func TestUpdateOrganizationPrivateRegistry_GetDomain(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{Domain: &zeroValue} + u.GetDomain() + u = &UpdateOrganizationPrivateRegistry{} + u.GetDomain() + u = nil + u.GetDomain() +} + +func TestUpdateOrganizationPrivateRegistry_GetDomainOwner(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{DomainOwner: &zeroValue} + u.GetDomainOwner() + u = &UpdateOrganizationPrivateRegistry{} + u.GetDomainOwner() + u = nil + u.GetDomainOwner() +} + func TestUpdateOrganizationPrivateRegistry_GetEncryptedValue(tt *testing.T) { tt.Parallel() var zeroValue string @@ -49821,6 +50047,28 @@ func TestUpdateOrganizationPrivateRegistry_GetEncryptedValue(tt *testing.T) { u.GetEncryptedValue() } +func TestUpdateOrganizationPrivateRegistry_GetIdentityMappingName(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{IdentityMappingName: &zeroValue} + u.GetIdentityMappingName() + u = &UpdateOrganizationPrivateRegistry{} + u.GetIdentityMappingName() + u = nil + u.GetIdentityMappingName() +} + +func TestUpdateOrganizationPrivateRegistry_GetJfrogOidcProviderName(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{JfrogOidcProviderName: &zeroValue} + u.GetJfrogOidcProviderName() + u = &UpdateOrganizationPrivateRegistry{} + u.GetJfrogOidcProviderName() + u = nil + u.GetJfrogOidcProviderName() +} + func TestUpdateOrganizationPrivateRegistry_GetKeyID(tt *testing.T) { tt.Parallel() var zeroValue string @@ -49843,6 +50091,28 @@ func TestUpdateOrganizationPrivateRegistry_GetRegistryType(tt *testing.T) { u.GetRegistryType() } +func TestUpdateOrganizationPrivateRegistry_GetReplacesBase(tt *testing.T) { + tt.Parallel() + var zeroValue bool + u := &UpdateOrganizationPrivateRegistry{ReplacesBase: &zeroValue} + u.GetReplacesBase() + u = &UpdateOrganizationPrivateRegistry{} + u.GetReplacesBase() + u = nil + u.GetReplacesBase() +} + +func TestUpdateOrganizationPrivateRegistry_GetRoleName(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{RoleName: &zeroValue} + u.GetRoleName() + u = &UpdateOrganizationPrivateRegistry{} + u.GetRoleName() + u = nil + u.GetRoleName() +} + func TestUpdateOrganizationPrivateRegistry_GetSelectedRepositoryIDs(tt *testing.T) { tt.Parallel() zeroValue := []int64{} @@ -49854,6 +50124,17 @@ func TestUpdateOrganizationPrivateRegistry_GetSelectedRepositoryIDs(tt *testing. u.GetSelectedRepositoryIDs() } +func TestUpdateOrganizationPrivateRegistry_GetTenantID(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateOrganizationPrivateRegistry{TenantID: &zeroValue} + u.GetTenantID() + u = &UpdateOrganizationPrivateRegistry{} + u.GetTenantID() + u = nil + u.GetTenantID() +} + func TestUpdateOrganizationPrivateRegistry_GetURL(tt *testing.T) { tt.Parallel() var zeroValue string diff --git a/github/private_registries.go b/github/private_registries.go index 045dbd37653..581ab45f533 100644 --- a/github/private_registries.go +++ b/github/private_registries.go @@ -13,7 +13,7 @@ import ( // PrivateRegistriesService handles communication with the private registries // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/private-registries?apiVersion=2022-11-28 +// GitHub API docs: https://docs.github.com/rest/private-registries?apiVersion=2026-03-10 type PrivateRegistriesService service // PrivateRegistryType represents the type of private registry. @@ -46,6 +46,17 @@ const ( PrivateRegistryVisibilitySelected PrivateRegistryVisibility = "selected" ) +// PrivateRegistryAuthType represents the authentication type for a private registry. +type PrivateRegistryAuthType string + +const ( + PrivateRegistryAuthTypeToken PrivateRegistryAuthType = "token" + PrivateRegistryAuthTypeUsernamePassword PrivateRegistryAuthType = "username_password" + PrivateRegistryAuthTypeOIDCAzure PrivateRegistryAuthType = "oidc_azure" + PrivateRegistryAuthTypeOIDCAWS PrivateRegistryAuthType = "oidc_aws" + PrivateRegistryAuthTypeOIDCJFrog PrivateRegistryAuthType = "oidc_jfrog" +) + // PrivateRegistry represents a private registry configuration. type PrivateRegistry struct { // Name of the private registry. @@ -61,6 +72,8 @@ type PrivateRegistry struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` // Visibility is the visibility of the private registry. Possible values are: "private", "all", and "selected". Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` + // SelectedRepositoryIDs is an array of repository IDs that can access the organization private registry. + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` } // PrivateRegistries represents a list of private registries. @@ -84,11 +97,17 @@ type CreateOrganizationPrivateRegistry struct { // This field should be omitted if the private registry does not require a username for authentication. Username *string `json:"username,omitempty"` + // ReplacesBase indicates whether this private registry should replace the base registry + // (e.g., npmjs.org for npm, rubygems.org for rubygems). + ReplacesBase *bool `json:"replaces_base,omitempty"` + // The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) // using the public key retrieved from the PrivateRegistriesService.GetOrganizationPrivateRegistriesPublicKey. - EncryptedValue string `json:"encrypted_value"` + // Required when AuthType is "token" or "username_password". Should be omitted for OIDC auth types. + EncryptedValue *string `json:"encrypted_value,omitempty"` // KeyID is the ID of the public key used to encrypt the secret. - KeyID string `json:"key_id"` + // Required when AuthType is "token" or "username_password". Should be omitted for OIDC auth types. + KeyID *string `json:"key_id,omitempty"` // Visibility is the visibility of the private registry. // Possible values are: "private", "all", and "selected". Visibility PrivateRegistryVisibility `json:"visibility"` @@ -97,6 +116,34 @@ type CreateOrganizationPrivateRegistry struct { // You can only provide a list of repository IDs when CreateOrganizationPrivateRegistry.Visibility is set to PrivateRegistryVisibilitySelected. // This field should be omitted if visibility is set to PrivateRegistryVisibilityAll or PrivateRegistryVisibilityPrivate. SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` + + // AuthType is the authentication type for the private registry. + // Defaults to "token" if not specified. Use "oidc_azure", "oidc_aws", or "oidc_jfrog" for OIDC authentication. + AuthType *string `json:"auth_type,omitempty"` + + // TenantID is the tenant ID of the Azure AD application. Required when AuthType is "oidc_azure". + TenantID *string `json:"tenant_id,omitempty"` + // ClientID is the client ID of the Azure AD application. Required when AuthType is "oidc_azure". + ClientID *string `json:"client_id,omitempty"` + + // AwsRegion is the AWS region. Required when AuthType is "oidc_aws". + AwsRegion *string `json:"aws_region,omitempty"` + // AccountID is the AWS account ID. Required when AuthType is "oidc_aws". + AccountID *string `json:"account_id,omitempty"` + // RoleName is the AWS IAM role name. Required when AuthType is "oidc_aws". + RoleName *string `json:"role_name,omitempty"` + // Domain is the CodeArtifact domain. Required when AuthType is "oidc_aws". + Domain *string `json:"domain,omitempty"` + // DomainOwner is the CodeArtifact domain owner (AWS account ID). Required when AuthType is "oidc_aws". + DomainOwner *string `json:"domain_owner,omitempty"` + + // JfrogOidcProviderName is the JFrog OIDC provider name. Required when AuthType is "oidc_jfrog". + JfrogOidcProviderName *string `json:"jfrog_oidc_provider_name,omitempty"` + + // Audience is the OIDC audience. Optional for "oidc_aws" and "oidc_jfrog" auth types. + Audience *string `json:"audience,omitempty"` + // IdentityMappingName is the JFrog identity mapping name. Optional for "oidc_jfrog" auth type. + IdentityMappingName *string `json:"identity_mapping_name,omitempty"` } // UpdateOrganizationPrivateRegistry represents the payload to update a private registry. @@ -112,6 +159,10 @@ type UpdateOrganizationPrivateRegistry struct { // This field should be omitted if the private registry does not require a username for authentication. Username *string `json:"username,omitempty"` + // ReplacesBase indicates whether this private registry should replace the base registry + // (e.g., npmjs.org for npm, rubygems.org for rubygems). + ReplacesBase *bool `json:"replaces_base,omitempty"` + // The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) // using the public key retrieved from the PrivateRegistriesService.GetOrganizationPrivateRegistriesPublicKey. EncryptedValue *string `json:"encrypted_value,omitempty"` @@ -122,9 +173,37 @@ type UpdateOrganizationPrivateRegistry struct { Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` // An array of repository IDs that can access the organization private registry. - // You can only provide a list of repository IDs when CreateOrganizationPrivateRegistry.Visibility is set to PrivateRegistryVisibilitySelected. + // You can only provide a list of repository IDs when UpdateOrganizationPrivateRegistry.Visibility is set to PrivateRegistryVisibilitySelected. // This field should be omitted if visibility is set to PrivateRegistryVisibilityAll or PrivateRegistryVisibilityPrivate. SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` + + // AuthType is the authentication type for the private registry. + // This field cannot be changed after creation. If provided, it must match the existing auth_type. + AuthType *string `json:"auth_type,omitempty"` + + // TenantID is the tenant ID of the Azure AD application. Required when AuthType is "oidc_azure". + TenantID *string `json:"tenant_id,omitempty"` + // ClientID is the client ID of the Azure AD application. Required when AuthType is "oidc_azure". + ClientID *string `json:"client_id,omitempty"` + + // AwsRegion is the AWS region. Required when AuthType is "oidc_aws". + AwsRegion *string `json:"aws_region,omitempty"` + // AccountID is the AWS account ID. Required when AuthType is "oidc_aws". + AccountID *string `json:"account_id,omitempty"` + // RoleName is the AWS IAM role name. Required when AuthType is "oidc_aws". + RoleName *string `json:"role_name,omitempty"` + // Domain is the CodeArtifact domain. Required when AuthType is "oidc_aws". + Domain *string `json:"domain,omitempty"` + // DomainOwner is the CodeArtifact domain owner (AWS account ID). Required when AuthType is "oidc_aws". + DomainOwner *string `json:"domain_owner,omitempty"` + + // JfrogOidcProviderName is the JFrog OIDC provider name. Required when AuthType is "oidc_jfrog". + JfrogOidcProviderName *string `json:"jfrog_oidc_provider_name,omitempty"` + + // Audience is the OIDC audience. Optional for "oidc_aws" and "oidc_jfrog" auth types. + Audience *string `json:"audience,omitempty"` + // IdentityMappingName is the JFrog identity mapping name. Optional for "oidc_jfrog" auth type. + IdentityMappingName *string `json:"identity_mapping_name,omitempty"` } // ListOrganizationPrivateRegistries lists private registries for an organization. @@ -223,21 +302,15 @@ func (s *PrivateRegistriesService) GetOrganizationPrivateRegistry(ctx context.Co // GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2022-11-28#update-a-private-registry-for-an-organization // //meta:operation PATCH /orgs/{org}/private-registries/{secret_name} -func (s *PrivateRegistriesService) UpdateOrganizationPrivateRegistry(ctx context.Context, org, secretName string, privateRegistry UpdateOrganizationPrivateRegistry) (*PrivateRegistry, *Response, error) { +func (s *PrivateRegistriesService) UpdateOrganizationPrivateRegistry(ctx context.Context, org, secretName string, privateRegistry UpdateOrganizationPrivateRegistry) (*Response, error) { u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) req, err := s.client.NewRequest("PATCH", u, privateRegistry) if err != nil { - return nil, nil, err - } - - var updatedRegistry PrivateRegistry - resp, err := s.client.Do(ctx, req, &updatedRegistry) - if err != nil { - return nil, resp, err + return nil, err } - return &updatedRegistry, resp, nil + return s.client.Do(ctx, req, nil) } // DeleteOrganizationPrivateRegistry deletes a specific private registry for an organization. diff --git a/github/private_registries_test.go b/github/private_registries_test.go index fd9531416a4..b8d6bc6bb89 100644 --- a/github/private_registries_test.go +++ b/github/private_registries_test.go @@ -93,8 +93,8 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry(t *testing.T RegistryType: "maven_repository", URL: "https://maven.pkg.github.com/OWNER/REPOSITORY", Username: Ptr("monalisa"), - EncryptedValue: "encrypted_value", - KeyID: "key_id", + EncryptedValue: Ptr("encrypted_value"), + KeyID: Ptr("key_id"), Visibility: PrivateRegistryVisibilitySelected, SelectedRepositoryIDs: []int64{1, 2, 3}, } @@ -108,13 +108,15 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry(t *testing.T t.Errorf("Request body = %+v, want %+v", v, input) } + w.WriteHeader(http.StatusCreated) fmt.Fprint(w, `{ "name": "MAVEN_REPOSITORY_SECRET", "registry_type": "maven_repository", "username": "monalisa", + "visibility": "selected", + "selected_repository_ids": [1, 2, 3], "created_at": "2019-08-10T14:59:22Z", - "updated_at": "2020-01-10T14:59:22Z", - "visibility": "selected" + "updated_at": "2020-01-10T14:59:22Z" }`) }) @@ -125,12 +127,13 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry(t *testing.T } want := &PrivateRegistry{ - Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr("maven_repository"), - Username: Ptr("monalisa"), - CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, - UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, - Visibility: Ptr(PrivateRegistryVisibilitySelected), + Name: Ptr("MAVEN_REPOSITORY_SECRET"), + RegistryType: Ptr("maven_repository"), + Username: Ptr("monalisa"), + CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, + UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, + Visibility: Ptr(PrivateRegistryVisibilitySelected), + SelectedRepositoryIDs: []int64{1, 2, 3}, } if diff := cmp.Diff(want, privateRegistry); diff != "" { t.Errorf("PrivateRegistries.CreateOrganizationPrivateRegistries mismatch (-want +got):\\n%v", diff) @@ -258,46 +261,23 @@ func TestPrivateRegistries_UpdateOrganizationPrivateRegistry(t *testing.T) { t.Errorf("Request body = %+v, want %+v", v, input) } - fmt.Fprint(w, `{ - "name": "MAVEN_REPOSITORY_SECRET", - "registry_type": "maven_repository", - "username": "monalisa", - "created_at": "2019-08-10T14:59:22Z", - "updated_at": "2020-01-10T14:59:22Z", - "visibility": "selected" -}`) + w.WriteHeader(http.StatusNoContent) }) ctx := t.Context() - privateRegistry, _, err := client.PrivateRegistries.UpdateOrganizationPrivateRegistry(ctx, "o", "MAVEN_REPOSITORY_SECRET", *input) + _, err := client.PrivateRegistries.UpdateOrganizationPrivateRegistry(ctx, "o", "MAVEN_REPOSITORY_SECRET", *input) if err != nil { t.Fatalf("PrivateRegistries.UpdateOrganizationPrivateRegistry returned error: %v", err) } - want := &PrivateRegistry{ - Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr("maven_repository"), - Username: Ptr("monalisa"), - CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, - UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, - Visibility: Ptr(PrivateRegistryVisibilitySelected), - } - if diff := cmp.Diff(want, privateRegistry); diff != "" { - t.Errorf("PrivateRegistries.UpdateOrganizationPrivateRegistry mismatch (-want +got):\\n%v", diff) - } - const methodName = "UpdateOrganizationPrivateRegistry" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.PrivateRegistries.UpdateOrganizationPrivateRegistry(ctx, "\n", "MAVEN_REPOSITORY_SECRET", *input) + _, err = client.PrivateRegistries.UpdateOrganizationPrivateRegistry(ctx, "\n", "MAVEN_REPOSITORY_SECRET", *input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.PrivateRegistries.UpdateOrganizationPrivateRegistry(ctx, "o", "MAVEN_REPOSITORY_SECRET", *input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err + return client.PrivateRegistries.UpdateOrganizationPrivateRegistry(ctx, "o", "MAVEN_REPOSITORY_SECRET", *input) }) } From eabe52f2c43b1b7623008f32fd753b930243c1c2 Mon Sep 17 00:00:00 2001 From: Misha Kushakov Date: Thu, 16 Apr 2026 15:20:06 +0200 Subject: [PATCH 2/6] feat(private-registry): add OIDC support tests for creating and updating private registries --- github/private_registries_test.go | 139 ++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/github/private_registries_test.go b/github/private_registries_test.go index b8d6bc6bb89..44efd3d3f17 100644 --- a/github/private_registries_test.go +++ b/github/private_registries_test.go @@ -154,6 +154,145 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry(t *testing.T }) } +func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDC(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + input := &CreateOrganizationPrivateRegistry{ + RegistryType: "maven_repository", + URL: "https://maven.pkg.github.com/OWNER/REPOSITORY", + AuthType: Ptr("oidc_azure"), + TenantID: Ptr("my-tenant-id"), + ClientID: Ptr("my-client-id"), + ReplacesBase: Ptr(true), + Visibility: PrivateRegistryVisibilitySelected, + SelectedRepositoryIDs: []int64{1, 2, 3}, + } + + mux.HandleFunc("/orgs/o/private-registries", func(w http.ResponseWriter, r *http.Request) { + var v *CreateOrganizationPrivateRegistry + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) + + testMethod(t, r, "POST") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + w.WriteHeader(http.StatusCreated) + fmt.Fprint(w, `{ + "name": "MAVEN_REPOSITORY_SECRET", + "registry_type": "maven_repository", + "visibility": "selected", + "selected_repository_ids": [1, 2, 3], + "created_at": "2019-08-10T14:59:22Z", + "updated_at": "2020-01-10T14:59:22Z" +}`) + }) + + ctx := t.Context() + privateRegistry, _, err := client.PrivateRegistries.CreateOrganizationPrivateRegistry(ctx, "o", *input) + if err != nil { + t.Fatalf("PrivateRegistries.CreateOrganizationPrivateRegistry (OIDC) returned error: %v", err) + } + + want := &PrivateRegistry{ + Name: Ptr("MAVEN_REPOSITORY_SECRET"), + RegistryType: Ptr("maven_repository"), + CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, + UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, + Visibility: Ptr(PrivateRegistryVisibilitySelected), + SelectedRepositoryIDs: []int64{1, 2, 3}, + } + if diff := cmp.Diff(want, privateRegistry); diff != "" { + t.Errorf("PrivateRegistries.CreateOrganizationPrivateRegistry (OIDC) mismatch (-want +got):\\n%v", diff) + } +} + +func TestPrivateRegistries_UpdateOrganizationPrivateRegistry_OIDC(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + input := &UpdateOrganizationPrivateRegistry{ + AuthType: Ptr("oidc_aws"), + AwsRegion: Ptr("us-east-1"), + AccountID: Ptr("123456789012"), + RoleName: Ptr("my-role"), + Domain: Ptr("my-domain"), + DomainOwner: Ptr("123456789012"), + Audience: Ptr("sts.amazonaws.com"), + Visibility: Ptr(PrivateRegistryVisibilitySelected), + } + + mux.HandleFunc("/orgs/o/private-registries/AWS_REGISTRY_SECRET", func(w http.ResponseWriter, r *http.Request) { + var v *UpdateOrganizationPrivateRegistry + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) + + testMethod(t, r, "PATCH") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + w.WriteHeader(http.StatusNoContent) + }) + + ctx := t.Context() + _, err := client.PrivateRegistries.UpdateOrganizationPrivateRegistry(ctx, "o", "AWS_REGISTRY_SECRET", *input) + if err != nil { + t.Fatalf("PrivateRegistries.UpdateOrganizationPrivateRegistry (OIDC) returned error: %v", err) + } +} + +func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDCJFrog(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + input := &CreateOrganizationPrivateRegistry{ + RegistryType: "npm_registry", + URL: "https://my.jfrog.io/artifactory/api/npm/npm-remote", + AuthType: Ptr("oidc_jfrog"), + JfrogOidcProviderName: Ptr("my-jfrog-provider"), + Audience: Ptr("jfrog"), + IdentityMappingName: Ptr("my-identity-mapping"), + Visibility: PrivateRegistryVisibilityPrivate, + } + + mux.HandleFunc("/orgs/o/private-registries", func(w http.ResponseWriter, r *http.Request) { + var v *CreateOrganizationPrivateRegistry + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) + + testMethod(t, r, "POST") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + w.WriteHeader(http.StatusCreated) + fmt.Fprint(w, `{ + "name": "NPM_REGISTRY_SECRET", + "registry_type": "npm_registry", + "visibility": "private", + "created_at": "2019-08-10T14:59:22Z", + "updated_at": "2020-01-10T14:59:22Z" +}`) + }) + + ctx := t.Context() + privateRegistry, _, err := client.PrivateRegistries.CreateOrganizationPrivateRegistry(ctx, "o", *input) + if err != nil { + t.Fatalf("PrivateRegistries.CreateOrganizationPrivateRegistry (OIDC JFrog) returned error: %v", err) + } + + want := &PrivateRegistry{ + Name: Ptr("NPM_REGISTRY_SECRET"), + RegistryType: Ptr("npm_registry"), + CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, + UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, + Visibility: Ptr(PrivateRegistryVisibilityPrivate), + } + if diff := cmp.Diff(want, privateRegistry); diff != "" { + t.Errorf("PrivateRegistries.CreateOrganizationPrivateRegistry (OIDC JFrog) mismatch (-want +got):\\n%v", diff) + } +} + func TestPrivateRegistriesService_GetOrganizationPrivateRegistriesPublicKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) From c7ab1b351fc6e43e684d62fc5f73f3170a50e7de Mon Sep 17 00:00:00 2001 From: Misha Kushakov Date: Thu, 16 Apr 2026 16:22:17 +0200 Subject: [PATCH 3/6] feat(private-registry): add API versioning support for private registry requests --- github/private_registries.go | 12 ++++++------ github/private_registries_test.go | 9 +++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/github/private_registries.go b/github/private_registries.go index 581ab45f533..6728ea92a97 100644 --- a/github/private_registries.go +++ b/github/private_registries.go @@ -218,7 +218,7 @@ func (s *PrivateRegistriesService) ListOrganizationPrivateRegistries(ctx context return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest("GET", u, nil, WithVersion("2026-03-10")) if err != nil { return nil, nil, err } @@ -239,7 +239,7 @@ func (s *PrivateRegistriesService) ListOrganizationPrivateRegistries(ctx context func (s *PrivateRegistriesService) CreateOrganizationPrivateRegistry(ctx context.Context, org string, privateRegistry CreateOrganizationPrivateRegistry) (*PrivateRegistry, *Response, error) { u := fmt.Sprintf("orgs/%v/private-registries", org) - req, err := s.client.NewRequest("POST", u, privateRegistry) + req, err := s.client.NewRequest("POST", u, privateRegistry, WithVersion("2026-03-10")) if err != nil { return nil, nil, err } @@ -260,7 +260,7 @@ func (s *PrivateRegistriesService) CreateOrganizationPrivateRegistry(ctx context func (s *PrivateRegistriesService) GetOrganizationPrivateRegistriesPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { u := fmt.Sprintf("orgs/%v/private-registries/public-key", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest("GET", u, nil, WithVersion("2026-03-10")) if err != nil { return nil, nil, err } @@ -282,7 +282,7 @@ func (s *PrivateRegistriesService) GetOrganizationPrivateRegistriesPublicKey(ctx func (s *PrivateRegistriesService) GetOrganizationPrivateRegistry(ctx context.Context, org, secretName string) (*PrivateRegistry, *Response, error) { u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest("GET", u, nil, WithVersion("2026-03-10")) if err != nil { return nil, nil, err } @@ -305,7 +305,7 @@ func (s *PrivateRegistriesService) GetOrganizationPrivateRegistry(ctx context.Co func (s *PrivateRegistriesService) UpdateOrganizationPrivateRegistry(ctx context.Context, org, secretName string, privateRegistry UpdateOrganizationPrivateRegistry) (*Response, error) { u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) - req, err := s.client.NewRequest("PATCH", u, privateRegistry) + req, err := s.client.NewRequest("PATCH", u, privateRegistry, WithVersion("2026-03-10")) if err != nil { return nil, err } @@ -322,7 +322,7 @@ func (s *PrivateRegistriesService) UpdateOrganizationPrivateRegistry(ctx context func (s *PrivateRegistriesService) DeleteOrganizationPrivateRegistry(ctx context.Context, org, secretName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest("DELETE", u, nil, WithVersion("2026-03-10")) if err != nil { return nil, err } diff --git a/github/private_registries_test.go b/github/private_registries_test.go index 44efd3d3f17..876c11c3146 100644 --- a/github/private_registries_test.go +++ b/github/private_registries_test.go @@ -22,6 +22,7 @@ func TestPrivateRegistriesService_ListOrganizationPrivateRegistries(t *testing.T mux.HandleFunc("/orgs/o/private-registries", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") + testHeader(t, r, "X-Github-Api-Version", "2026-03-10") testFormValues(t, r, values{ "page": "2", }) @@ -104,6 +105,7 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry(t *testing.T assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "POST") + testHeader(t, r, "X-Github-Api-Version", "2026-03-10") if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -174,6 +176,7 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDC(t *test assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "POST") + testHeader(t, r, "X-Github-Api-Version", "2026-03-10") if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -228,6 +231,7 @@ func TestPrivateRegistries_UpdateOrganizationPrivateRegistry_OIDC(t *testing.T) assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "PATCH") + testHeader(t, r, "X-Github-Api-Version", "2026-03-10") if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -261,6 +265,7 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDCJFrog(t assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "POST") + testHeader(t, r, "X-Github-Api-Version", "2026-03-10") if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -299,6 +304,7 @@ func TestPrivateRegistriesService_GetOrganizationPrivateRegistriesPublicKey(t *t mux.HandleFunc("/orgs/o/private-registries/public-key", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") + testHeader(t, r, "X-Github-Api-Version", "2026-03-10") fmt.Fprint(w, `{ "key_id": "0123456789", "key": "public_key" @@ -339,6 +345,7 @@ func TestPrivateRegistriesService_GetOrganizationPrivateRegistry(t *testing.T) { mux.HandleFunc("/orgs/o/private-registries/MAVEN_REPOSITORY_SECRET", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") + testHeader(t, r, "X-Github-Api-Version", "2026-03-10") fmt.Fprint(w, `{ "name": "MAVEN_REPOSITORY_SECRET", "registry_type": "maven_repository", @@ -396,6 +403,7 @@ func TestPrivateRegistries_UpdateOrganizationPrivateRegistry(t *testing.T) { assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "PATCH") + testHeader(t, r, "X-Github-Api-Version", "2026-03-10") if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -426,6 +434,7 @@ func TestPrivateRegistriesService_DeleteOrganizationPrivateRegistry(t *testing.T mux.HandleFunc("/orgs/o/private-registries/MAVEN_REPOSITORY_SECRET", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") + testHeader(t, r, "X-Github-Api-Version", "2026-03-10") w.WriteHeader(http.StatusNoContent) }) ctx := t.Context() From 4e9e20f4cbb58c47fd47cc826b24afcbb5d5cfc5 Mon Sep 17 00:00:00 2001 From: Misha Kushakov Date: Fri, 17 Apr 2026 09:10:37 +0200 Subject: [PATCH 4/6] feat(private-registry): enhance private registry model with new fields and update accessors --- github/github-accessors.go | 110 +++++++++++++++++++++- github/github-accessors_test.go | 147 +++++++++++++++++++++++++++++- github/private_registries.go | 40 ++++++-- github/private_registries_test.go | 20 ++-- 4 files changed, 295 insertions(+), 22 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index ad5957d353b..b7db7e889d1 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -9599,7 +9599,7 @@ func (c *CreateOrganizationPrivateRegistry) GetKeyID() string { } // GetRegistryType returns the RegistryType field. -func (c *CreateOrganizationPrivateRegistry) GetRegistryType() string { +func (c *CreateOrganizationPrivateRegistry) GetRegistryType() PrivateRegistryType { if c == nil { return "" } @@ -26118,6 +26118,78 @@ func (p *PrivateRegistry) GetCreatedAt() Timestamp { return *p.CreatedAt } +// GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAccountID() string { + if p == nil || p.AccountID == nil { + return "" + } + return *p.AccountID +} + +// GetAudience returns the Audience field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAudience() string { + if p == nil || p.Audience == nil { + return "" + } + return *p.Audience +} + +// GetAuthType returns the AuthType field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAuthType() PrivateRegistryAuthType { + if p == nil || p.AuthType == nil { + return "" + } + return *p.AuthType +} + +// GetAwsRegion returns the AwsRegion field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAwsRegion() string { + if p == nil || p.AwsRegion == nil { + return "" + } + return *p.AwsRegion +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetClientID() string { + if p == nil || p.ClientID == nil { + return "" + } + return *p.ClientID +} + +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetDomain() string { + if p == nil || p.Domain == nil { + return "" + } + return *p.Domain +} + +// GetDomainOwner returns the DomainOwner field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetDomainOwner() string { + if p == nil || p.DomainOwner == nil { + return "" + } + return *p.DomainOwner +} + +// GetIdentityMappingName returns the IdentityMappingName field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetIdentityMappingName() string { + if p == nil || p.IdentityMappingName == nil { + return "" + } + return *p.IdentityMappingName +} + +// GetJfrogOidcProviderName returns the JfrogOidcProviderName field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetJfrogOidcProviderName() string { + if p == nil || p.JfrogOidcProviderName == nil { + return "" + } + return *p.JfrogOidcProviderName +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (p *PrivateRegistry) GetName() string { if p == nil || p.Name == nil { @@ -26127,7 +26199,7 @@ func (p *PrivateRegistry) GetName() string { } // GetRegistryType returns the RegistryType field if it's non-nil, zero value otherwise. -func (p *PrivateRegistry) GetRegistryType() string { +func (p *PrivateRegistry) GetRegistryType() PrivateRegistryType { if p == nil || p.RegistryType == nil { return "" } @@ -26142,6 +26214,38 @@ func (p *PrivateRegistry) GetSelectedRepositoryIDs() []int64 { return p.SelectedRepositoryIDs } +// GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetReplacesBase() bool { + if p == nil || p.ReplacesBase == nil { + return false + } + return *p.ReplacesBase +} + +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetRoleName() string { + if p == nil || p.RoleName == nil { + return "" + } + return *p.RoleName +} + +// GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetTenantID() string { + if p == nil || p.TenantID == nil { + return "" + } + return *p.TenantID +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (p *PrivateRegistry) GetUpdatedAt() Timestamp { if p == nil || p.UpdatedAt == nil { @@ -39823,7 +39927,7 @@ func (u *UpdateOrganizationPrivateRegistry) GetKeyID() string { } // GetRegistryType returns the RegistryType field if it's non-nil, zero value otherwise. -func (u *UpdateOrganizationPrivateRegistry) GetRegistryType() string { +func (u *UpdateOrganizationPrivateRegistry) GetRegistryType() PrivateRegistryType { if u == nil || u.RegistryType == nil { return "" } diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index ad1a0e3b7f9..936de5fc342 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -33035,7 +33035,7 @@ func TestPrivateRegistry_GetName(tt *testing.T) { func TestPrivateRegistry_GetRegistryType(tt *testing.T) { tt.Parallel() - var zeroValue string + var zeroValue PrivateRegistryType p := &PrivateRegistry{RegistryType: &zeroValue} p.GetRegistryType() p = &PrivateRegistry{} @@ -33044,6 +33044,149 @@ func TestPrivateRegistry_GetRegistryType(tt *testing.T) { p.GetRegistryType() } +func TestPrivateRegistry_GetAccountID(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{AccountID: &zeroValue} + p.GetAccountID() + p = &PrivateRegistry{} + p.GetAccountID() + p = nil + p.GetAccountID() +} + +func TestPrivateRegistry_GetAudience(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{Audience: &zeroValue} + p.GetAudience() + p = &PrivateRegistry{} + p.GetAudience() + p = nil + p.GetAudience() +} + +func TestPrivateRegistry_GetAuthType(tt *testing.T) { + tt.Parallel() + var zeroValue PrivateRegistryAuthType + p := &PrivateRegistry{AuthType: &zeroValue} + p.GetAuthType() + p = &PrivateRegistry{} + p.GetAuthType() + p = nil + p.GetAuthType() +} + +func TestPrivateRegistry_GetAwsRegion(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{AwsRegion: &zeroValue} + p.GetAwsRegion() + p = &PrivateRegistry{} + p.GetAwsRegion() + p = nil + p.GetAwsRegion() +} + +func TestPrivateRegistry_GetClientID(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{ClientID: &zeroValue} + p.GetClientID() + p = &PrivateRegistry{} + p.GetClientID() + p = nil + p.GetClientID() +} + +func TestPrivateRegistry_GetDomain(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{Domain: &zeroValue} + p.GetDomain() + p = &PrivateRegistry{} + p.GetDomain() + p = nil + p.GetDomain() +} + +func TestPrivateRegistry_GetDomainOwner(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{DomainOwner: &zeroValue} + p.GetDomainOwner() + p = &PrivateRegistry{} + p.GetDomainOwner() + p = nil + p.GetDomainOwner() +} + +func TestPrivateRegistry_GetIdentityMappingName(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{IdentityMappingName: &zeroValue} + p.GetIdentityMappingName() + p = &PrivateRegistry{} + p.GetIdentityMappingName() + p = nil + p.GetIdentityMappingName() +} + +func TestPrivateRegistry_GetJfrogOidcProviderName(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{JfrogOidcProviderName: &zeroValue} + p.GetJfrogOidcProviderName() + p = &PrivateRegistry{} + p.GetJfrogOidcProviderName() + p = nil + p.GetJfrogOidcProviderName() +} + +func TestPrivateRegistry_GetReplacesBase(tt *testing.T) { + tt.Parallel() + var zeroValue bool + p := &PrivateRegistry{ReplacesBase: &zeroValue} + p.GetReplacesBase() + p = &PrivateRegistry{} + p.GetReplacesBase() + p = nil + p.GetReplacesBase() +} + +func TestPrivateRegistry_GetRoleName(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{RoleName: &zeroValue} + p.GetRoleName() + p = &PrivateRegistry{} + p.GetRoleName() + p = nil + p.GetRoleName() +} + +func TestPrivateRegistry_GetTenantID(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{TenantID: &zeroValue} + p.GetTenantID() + p = &PrivateRegistry{} + p.GetTenantID() + p = nil + p.GetTenantID() +} + +func TestPrivateRegistry_GetURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{URL: &zeroValue} + p.GetURL() + p = &PrivateRegistry{} + p.GetURL() + p = nil + p.GetURL() +} + func TestPrivateRegistry_GetSelectedRepositoryIDs(tt *testing.T) { tt.Parallel() zeroValue := []int64{} @@ -50082,7 +50225,7 @@ func TestUpdateOrganizationPrivateRegistry_GetKeyID(tt *testing.T) { func TestUpdateOrganizationPrivateRegistry_GetRegistryType(tt *testing.T) { tt.Parallel() - var zeroValue string + var zeroValue PrivateRegistryType u := &UpdateOrganizationPrivateRegistry{RegistryType: &zeroValue} u.GetRegistryType() u = &UpdateOrganizationPrivateRegistry{} diff --git a/github/private_registries.go b/github/private_registries.go index 6728ea92a97..a220fea6cff 100644 --- a/github/private_registries.go +++ b/github/private_registries.go @@ -62,18 +62,44 @@ type PrivateRegistry struct { // Name of the private registry. Name *string `json:"name,omitempty"` // RegistryType is the type of private registry. You can find the list of supported types in PrivateRegistryType. - RegistryType *string `json:"registry_type,omitempty"` + RegistryType *PrivateRegistryType `json:"registry_type,omitempty"` + // AuthType is the authentication type for the private registry. + AuthType *PrivateRegistryAuthType `json:"auth_type,omitempty"` + // URL is the URL of the private registry. + URL *string `json:"url,omitempty"` // Username to use when authenticating with the private registry. // This field is omitted if the private registry does not require a username for authentication. Username *string `json:"username,omitempty"` - // CreatedAt is the timestamp when the private registry was created. - CreatedAt *Timestamp `json:"created_at,omitempty"` - // UpdatedAt is the timestamp when the private registry was last updated. - UpdatedAt *Timestamp `json:"updated_at,omitempty"` + // ReplacesBase indicates whether this private registry should replace the base registry. + ReplacesBase *bool `json:"replaces_base,omitempty"` // Visibility is the visibility of the private registry. Possible values are: "private", "all", and "selected". Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` // SelectedRepositoryIDs is an array of repository IDs that can access the organization private registry. SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` + // TenantID is the tenant ID of the Azure AD application. + TenantID *string `json:"tenant_id,omitempty"` + // ClientID is the client ID of the Azure AD application. + ClientID *string `json:"client_id,omitempty"` + // AwsRegion is the AWS region. + AwsRegion *string `json:"aws_region,omitempty"` + // AccountID is the AWS account ID. + AccountID *string `json:"account_id,omitempty"` + // RoleName is the AWS IAM role name. + RoleName *string `json:"role_name,omitempty"` + // Domain is the CodeArtifact domain. + Domain *string `json:"domain,omitempty"` + // DomainOwner is the CodeArtifact domain owner. + DomainOwner *string `json:"domain_owner,omitempty"` + // JfrogOidcProviderName is the JFrog OIDC provider name. + JfrogOidcProviderName *string `json:"jfrog_oidc_provider_name,omitempty"` + // Audience is the OIDC audience. + Audience *string `json:"audience,omitempty"` + // IdentityMappingName is the JFrog identity mapping name. + IdentityMappingName *string `json:"identity_mapping_name,omitempty"` + // CreatedAt is the timestamp when the private registry was created. + CreatedAt *Timestamp `json:"created_at,omitempty"` + // UpdatedAt is the timestamp when the private registry was last updated. + UpdatedAt *Timestamp `json:"updated_at,omitempty"` } // PrivateRegistries represents a list of private registries. @@ -88,7 +114,7 @@ type PrivateRegistries struct { type CreateOrganizationPrivateRegistry struct { // RegistryType is the type of private registry. // You can find the list of supported types in PrivateRegistryType. - RegistryType string `json:"registry_type"` + RegistryType PrivateRegistryType `json:"registry_type"` // URL is the URL of the private registry. URL string `json:"url"` @@ -150,7 +176,7 @@ type CreateOrganizationPrivateRegistry struct { type UpdateOrganizationPrivateRegistry struct { // RegistryType is the type of private registry. // You can find the list of supported types in PrivateRegistryType. - RegistryType *string `json:"registry_type,omitempty"` + RegistryType *PrivateRegistryType `json:"registry_type,omitempty"` // URL is the URL of the private registry. URL *string `json:"url,omitempty"` diff --git a/github/private_registries_test.go b/github/private_registries_test.go index 876c11c3146..2038887f36f 100644 --- a/github/private_registries_test.go +++ b/github/private_registries_test.go @@ -53,7 +53,7 @@ func TestPrivateRegistriesService_ListOrganizationPrivateRegistries(t *testing.T Configurations: []*PrivateRegistry{ { Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr("maven_repository"), + RegistryType: Ptr(PrivateRegistryTypeMavenRepository), Username: Ptr("monalisa"), CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, @@ -91,7 +91,7 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry(t *testing.T client, mux, _ := setup(t) input := &CreateOrganizationPrivateRegistry{ - RegistryType: "maven_repository", + RegistryType: PrivateRegistryTypeMavenRepository, URL: "https://maven.pkg.github.com/OWNER/REPOSITORY", Username: Ptr("monalisa"), EncryptedValue: Ptr("encrypted_value"), @@ -130,7 +130,7 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry(t *testing.T want := &PrivateRegistry{ Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr("maven_repository"), + RegistryType: Ptr(PrivateRegistryTypeMavenRepository), Username: Ptr("monalisa"), CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, @@ -161,8 +161,8 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDC(t *test client, mux, _ := setup(t) input := &CreateOrganizationPrivateRegistry{ - RegistryType: "maven_repository", - URL: "https://maven.pkg.github.com/OWNER/REPOSITORY", + RegistryType: PrivateRegistryTypeMavenRepository, + URL: "https://example.com/maven", AuthType: Ptr("oidc_azure"), TenantID: Ptr("my-tenant-id"), ClientID: Ptr("my-client-id"), @@ -200,7 +200,7 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDC(t *test want := &PrivateRegistry{ Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr("maven_repository"), + RegistryType: Ptr(PrivateRegistryTypeMavenRepository), CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, Visibility: Ptr(PrivateRegistryVisibilitySelected), @@ -251,8 +251,8 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDCJFrog(t client, mux, _ := setup(t) input := &CreateOrganizationPrivateRegistry{ - RegistryType: "npm_registry", - URL: "https://my.jfrog.io/artifactory/api/npm/npm-remote", + RegistryType: PrivateRegistryTypeNpmRegistry, + URL: "https://example.com/npm", AuthType: Ptr("oidc_jfrog"), JfrogOidcProviderName: Ptr("my-jfrog-provider"), Audience: Ptr("jfrog"), @@ -288,7 +288,7 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDCJFrog(t want := &PrivateRegistry{ Name: Ptr("NPM_REGISTRY_SECRET"), - RegistryType: Ptr("npm_registry"), + RegistryType: Ptr(PrivateRegistryTypeNpmRegistry), CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, Visibility: Ptr(PrivateRegistryVisibilityPrivate), @@ -363,7 +363,7 @@ func TestPrivateRegistriesService_GetOrganizationPrivateRegistry(t *testing.T) { want := &PrivateRegistry{ Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr("maven_repository"), + RegistryType: Ptr(PrivateRegistryTypeMavenRepository), Username: Ptr("monalisa"), CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, From ac77d7a64af4f072958d27f5926a25f83a3acd1e Mon Sep 17 00:00:00 2001 From: Misha Kushakov Date: Fri, 17 Apr 2026 09:17:07 +0200 Subject: [PATCH 5/6] refactor(private-registry): simplify accessors and update test cases for consistency --- github/github-accessors.go | 76 ++++++++++----------- github/github-accessors_test.go | 117 +++++++++++++++----------------- 2 files changed, 92 insertions(+), 101 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index b7db7e889d1..8d4672f6c96 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -26110,14 +26110,6 @@ func (p *PrivateRegistries) GetTotalCount() int { return *p.TotalCount } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PrivateRegistry) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} - } - return *p.CreatedAt -} - // GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. func (p *PrivateRegistry) GetAccountID() string { if p == nil || p.AccountID == nil { @@ -26134,12 +26126,12 @@ func (p *PrivateRegistry) GetAudience() string { return *p.Audience } -// GetAuthType returns the AuthType field if it's non-nil, zero value otherwise. -func (p *PrivateRegistry) GetAuthType() PrivateRegistryAuthType { - if p == nil || p.AuthType == nil { - return "" +// GetAuthType returns the AuthType field. +func (p *PrivateRegistry) GetAuthType() *PrivateRegistryAuthType { + if p == nil { + return nil } - return *p.AuthType + return p.AuthType } // GetAwsRegion returns the AwsRegion field if it's non-nil, zero value otherwise. @@ -26158,6 +26150,14 @@ func (p *PrivateRegistry) GetClientID() string { return *p.ClientID } +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + // GetDomain returns the Domain field if it's non-nil, zero value otherwise. func (p *PrivateRegistry) GetDomain() string { if p == nil || p.Domain == nil { @@ -26198,20 +26198,12 @@ func (p *PrivateRegistry) GetName() string { return *p.Name } -// GetRegistryType returns the RegistryType field if it's non-nil, zero value otherwise. -func (p *PrivateRegistry) GetRegistryType() PrivateRegistryType { - if p == nil || p.RegistryType == nil { - return "" - } - return *p.RegistryType -} - -// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. -func (p *PrivateRegistry) GetSelectedRepositoryIDs() []int64 { - if p == nil || p.SelectedRepositoryIDs == nil { +// GetRegistryType returns the RegistryType field. +func (p *PrivateRegistry) GetRegistryType() *PrivateRegistryType { + if p == nil { return nil } - return p.SelectedRepositoryIDs + return p.RegistryType } // GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. @@ -26230,6 +26222,14 @@ func (p *PrivateRegistry) GetRoleName() string { return *p.RoleName } +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (p *PrivateRegistry) GetSelectedRepositoryIDs() []int64 { + if p == nil || p.SelectedRepositoryIDs == nil { + return nil + } + return p.SelectedRepositoryIDs +} + // GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. func (p *PrivateRegistry) GetTenantID() string { if p == nil || p.TenantID == nil { @@ -26238,14 +26238,6 @@ func (p *PrivateRegistry) GetTenantID() string { return *p.TenantID } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PrivateRegistry) GetURL() string { - if p == nil || p.URL == nil { - return "" - } - return *p.URL -} - // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (p *PrivateRegistry) GetUpdatedAt() Timestamp { if p == nil || p.UpdatedAt == nil { @@ -26254,6 +26246,14 @@ func (p *PrivateRegistry) GetUpdatedAt() Timestamp { return *p.UpdatedAt } +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + // GetUsername returns the Username field if it's non-nil, zero value otherwise. func (p *PrivateRegistry) GetUsername() string { if p == nil || p.Username == nil { @@ -39926,12 +39926,12 @@ func (u *UpdateOrganizationPrivateRegistry) GetKeyID() string { return *u.KeyID } -// GetRegistryType returns the RegistryType field if it's non-nil, zero value otherwise. -func (u *UpdateOrganizationPrivateRegistry) GetRegistryType() PrivateRegistryType { - if u == nil || u.RegistryType == nil { - return "" +// GetRegistryType returns the RegistryType field. +func (u *UpdateOrganizationPrivateRegistry) GetRegistryType() *PrivateRegistryType { + if u == nil { + return nil } - return *u.RegistryType + return u.RegistryType } // GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 936de5fc342..27bc32d9d43 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -33011,39 +33011,6 @@ func TestPrivateRegistries_GetTotalCount(tt *testing.T) { p.GetTotalCount() } -func TestPrivateRegistry_GetCreatedAt(tt *testing.T) { - tt.Parallel() - var zeroValue Timestamp - p := &PrivateRegistry{CreatedAt: &zeroValue} - p.GetCreatedAt() - p = &PrivateRegistry{} - p.GetCreatedAt() - p = nil - p.GetCreatedAt() -} - -func TestPrivateRegistry_GetName(tt *testing.T) { - tt.Parallel() - var zeroValue string - p := &PrivateRegistry{Name: &zeroValue} - p.GetName() - p = &PrivateRegistry{} - p.GetName() - p = nil - p.GetName() -} - -func TestPrivateRegistry_GetRegistryType(tt *testing.T) { - tt.Parallel() - var zeroValue PrivateRegistryType - p := &PrivateRegistry{RegistryType: &zeroValue} - p.GetRegistryType() - p = &PrivateRegistry{} - p.GetRegistryType() - p = nil - p.GetRegistryType() -} - func TestPrivateRegistry_GetAccountID(tt *testing.T) { tt.Parallel() var zeroValue string @@ -33068,10 +33035,7 @@ func TestPrivateRegistry_GetAudience(tt *testing.T) { func TestPrivateRegistry_GetAuthType(tt *testing.T) { tt.Parallel() - var zeroValue PrivateRegistryAuthType - p := &PrivateRegistry{AuthType: &zeroValue} - p.GetAuthType() - p = &PrivateRegistry{} + p := &PrivateRegistry{} p.GetAuthType() p = nil p.GetAuthType() @@ -33099,6 +33063,17 @@ func TestPrivateRegistry_GetClientID(tt *testing.T) { p.GetClientID() } +func TestPrivateRegistry_GetCreatedAt(tt *testing.T) { + tt.Parallel() + var zeroValue Timestamp + p := &PrivateRegistry{CreatedAt: &zeroValue} + p.GetCreatedAt() + p = &PrivateRegistry{} + p.GetCreatedAt() + p = nil + p.GetCreatedAt() +} + func TestPrivateRegistry_GetDomain(tt *testing.T) { tt.Parallel() var zeroValue string @@ -33143,6 +33118,25 @@ func TestPrivateRegistry_GetJfrogOidcProviderName(tt *testing.T) { p.GetJfrogOidcProviderName() } +func TestPrivateRegistry_GetName(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{Name: &zeroValue} + p.GetName() + p = &PrivateRegistry{} + p.GetName() + p = nil + p.GetName() +} + +func TestPrivateRegistry_GetRegistryType(tt *testing.T) { + tt.Parallel() + p := &PrivateRegistry{} + p.GetRegistryType() + p = nil + p.GetRegistryType() +} + func TestPrivateRegistry_GetReplacesBase(tt *testing.T) { tt.Parallel() var zeroValue bool @@ -33165,28 +33159,6 @@ func TestPrivateRegistry_GetRoleName(tt *testing.T) { p.GetRoleName() } -func TestPrivateRegistry_GetTenantID(tt *testing.T) { - tt.Parallel() - var zeroValue string - p := &PrivateRegistry{TenantID: &zeroValue} - p.GetTenantID() - p = &PrivateRegistry{} - p.GetTenantID() - p = nil - p.GetTenantID() -} - -func TestPrivateRegistry_GetURL(tt *testing.T) { - tt.Parallel() - var zeroValue string - p := &PrivateRegistry{URL: &zeroValue} - p.GetURL() - p = &PrivateRegistry{} - p.GetURL() - p = nil - p.GetURL() -} - func TestPrivateRegistry_GetSelectedRepositoryIDs(tt *testing.T) { tt.Parallel() zeroValue := []int64{} @@ -33198,6 +33170,17 @@ func TestPrivateRegistry_GetSelectedRepositoryIDs(tt *testing.T) { p.GetSelectedRepositoryIDs() } +func TestPrivateRegistry_GetTenantID(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{TenantID: &zeroValue} + p.GetTenantID() + p = &PrivateRegistry{} + p.GetTenantID() + p = nil + p.GetTenantID() +} + func TestPrivateRegistry_GetUpdatedAt(tt *testing.T) { tt.Parallel() var zeroValue Timestamp @@ -33209,6 +33192,17 @@ func TestPrivateRegistry_GetUpdatedAt(tt *testing.T) { p.GetUpdatedAt() } +func TestPrivateRegistry_GetURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + p := &PrivateRegistry{URL: &zeroValue} + p.GetURL() + p = &PrivateRegistry{} + p.GetURL() + p = nil + p.GetURL() +} + func TestPrivateRegistry_GetUsername(tt *testing.T) { tt.Parallel() var zeroValue string @@ -50225,10 +50219,7 @@ func TestUpdateOrganizationPrivateRegistry_GetKeyID(tt *testing.T) { func TestUpdateOrganizationPrivateRegistry_GetRegistryType(tt *testing.T) { tt.Parallel() - var zeroValue PrivateRegistryType - u := &UpdateOrganizationPrivateRegistry{RegistryType: &zeroValue} - u.GetRegistryType() - u = &UpdateOrganizationPrivateRegistry{} + u := &UpdateOrganizationPrivateRegistry{} u.GetRegistryType() u = nil u.GetRegistryType() From a84603bb56532a79822f7c37b396d23db2d15f8b Mon Sep 17 00:00:00 2001 From: Misha Kushakov Date: Fri, 17 Apr 2026 09:19:20 +0200 Subject: [PATCH 6/6] fix(private-registry): update audience value in OIDC private registry update test --- github/private_registries_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/private_registries_test.go b/github/private_registries_test.go index 2038887f36f..781c859ad93 100644 --- a/github/private_registries_test.go +++ b/github/private_registries_test.go @@ -222,7 +222,7 @@ func TestPrivateRegistries_UpdateOrganizationPrivateRegistry_OIDC(t *testing.T) RoleName: Ptr("my-role"), Domain: Ptr("my-domain"), DomainOwner: Ptr("123456789012"), - Audience: Ptr("sts.amazonaws.com"), + Audience: Ptr("example.com"), Visibility: Ptr(PrivateRegistryVisibilitySelected), }