From 18fdd90412c49301c507f182216742ecb40f7e1d Mon Sep 17 00:00:00 2001 From: "krisztian@peak.com" Date: Fri, 12 Jun 2026 12:08:09 +0300 Subject: [PATCH 1/8] fix: Fix License Status response and Supportkey type --- github/enterprise_manage_ghes_config.go | 6 +++--- github/enterprise_manage_ghes_config_test.go | 12 ++++++------ github/github-accessors.go | 4 ++-- github/github-accessors_test.go | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index 9770d044af3..819788ebfc6 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -87,7 +87,7 @@ type LicenseStatus struct { ReferenceNumber *string `json:"referenceNumber,omitempty"` Seats *int `json:"seats,omitempty"` SSHAllowed *bool `json:"sshAllowed,omitempty"` - SupportKey *string `json:"supportKey,omitempty"` + SupportKey *bool `json:"supportKey,omitempty"` UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` } @@ -354,14 +354,14 @@ func (s *EnterpriseService) InitialConfig(ctx context.Context, license, password // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information // //meta:operation GET /manage/v1/config/license -func (s *EnterpriseService) License(ctx context.Context) ([]*LicenseStatus, *Response, error) { +func (s *EnterpriseService) License(ctx context.Context) (*LicenseStatus, *Response, error) { u := "manage/v1/config/license" req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - var licenseStatus []*LicenseStatus + var licenseStatus *LicenseStatus resp, err := s.client.Do(req, &licenseStatus) if err != nil { return nil, resp, err diff --git a/github/enterprise_manage_ghes_config_test.go b/github/enterprise_manage_ghes_config_test.go index 46fa8e213e4..3c793149585 100644 --- a/github/enterprise_manage_ghes_config_test.go +++ b/github/enterprise_manage_ghes_config_test.go @@ -407,7 +407,7 @@ func TestEnterpriseService_License(t *testing.T) { mux.HandleFunc("/manage/v1/config/license", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `[{ + fmt.Fprint(w, `{ "advancedSecurityEnabled": true, "advancedSecuritySeats": 0, "clusterSupport": false, @@ -424,9 +424,9 @@ func TestEnterpriseService_License(t *testing.T) { "referenceNumber": "32a145", "seats": 0, "sshAllowed": true, - "supportKey": "", + "supportKey": true, "unlimitedSeating": true - }]`) + }`) }) ctx := t.Context() @@ -435,7 +435,7 @@ func TestEnterpriseService_License(t *testing.T) { t.Errorf("Enterprise.License returned error: %v", err) } - want := []*LicenseStatus{{ + want := &LicenseStatus{ AdvancedSecurityEnabled: Ptr(true), AdvancedSecuritySeats: Ptr(0), ClusterSupport: Ptr(false), @@ -452,9 +452,9 @@ func TestEnterpriseService_License(t *testing.T) { ReferenceNumber: Ptr("32a145"), Seats: Ptr(0), SSHAllowed: Ptr(true), - SupportKey: Ptr(""), + SupportKey: Ptr(true), UnlimitedSeating: Ptr(true), - }} + } if diff := cmp.Diff(want, license); diff != "" { t.Errorf("diff mismatch (-want +got):\n%v", diff) } diff --git a/github/github-accessors.go b/github/github-accessors.go index bc3194bc1b6..99f7754c537 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -21039,9 +21039,9 @@ func (l *LicenseStatus) GetSSHAllowed() bool { } // GetSupportKey returns the SupportKey field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetSupportKey() string { +func (l *LicenseStatus) GetSupportKey() bool { if l == nil || l.SupportKey == nil { - return "" + return false } return *l.SupportKey } diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c9ced173fe0..bcfc91818d8 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -26630,7 +26630,7 @@ func TestLicenseStatus_GetSSHAllowed(tt *testing.T) { func TestLicenseStatus_GetSupportKey(tt *testing.T) { tt.Parallel() - var zeroValue string + var zeroValue bool l := &LicenseStatus{SupportKey: &zeroValue} l.GetSupportKey() l = &LicenseStatus{} From 77c857036240871307b80665e05c14224a140cc4 Mon Sep 17 00:00:00 2001 From: Krisztian Banhidy Date: Mon, 15 Jun 2026 14:04:01 +0300 Subject: [PATCH 2/8] fix!: Add comment for clarification --- github/enterprise_manage_ghes_config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index 819788ebfc6..e95f97b9f75 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -70,6 +70,8 @@ type InitialConfigOptions struct { } // LicenseStatus is a struct to hold the response from the License API. +// SupportKey is documented as string but is actual a bool. +// TODO: Remove comment after github updates schema documentation type LicenseStatus struct { AdvancedSecurityEnabled *bool `json:"advancedSecurityEnabled,omitempty"` AdvancedSecuritySeats *int `json:"advancedSecuritySeats,omitempty"` @@ -354,6 +356,8 @@ func (s *EnterpriseService) InitialConfig(ctx context.Context, license, password // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information // //meta:operation GET /manage/v1/config/license +// Current Docs shouw incorrect return type. They list as [{...}] but actual is {...} +// TODO: Remove comment after github updates schema documentation func (s *EnterpriseService) License(ctx context.Context) (*LicenseStatus, *Response, error) { u := "manage/v1/config/license" req, err := s.client.NewRequest(ctx, "GET", u, nil) From 58a9e832a946aee19223568038dfc725f9c62594 Mon Sep 17 00:00:00 2001 From: Krisztian Banhidy Date: Mon, 15 Jun 2026 18:02:29 +0300 Subject: [PATCH 3/8] Update github/enterprise_manage_ghes_config.go Co-authored-by: Oleksandr Redko --- github/enterprise_manage_ghes_config.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index e95f97b9f75..6efd82c23c5 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -89,7 +89,9 @@ type LicenseStatus struct { ReferenceNumber *string `json:"referenceNumber,omitempty"` Seats *int `json:"seats,omitempty"` SSHAllowed *bool `json:"sshAllowed,omitempty"` - SupportKey *bool `json:"supportKey,omitempty"` + // SupportKey is documented as a string, but the actual response is a bool. + // TODO: Remove this note once GitHub corrects the schema documentation. + SupportKey *bool `json:"supportKey,omitempty"` UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` } From 6bfe99b0f6c8ea978bd4d8016da4114f16c300a4 Mon Sep 17 00:00:00 2001 From: Krisztian Banhidy Date: Tue, 16 Jun 2026 11:00:52 +0300 Subject: [PATCH 4/8] fix: Update note --- github/enterprise_manage_ghes_config.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index 6efd82c23c5..ba042cc6087 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -355,11 +355,13 @@ func (s *EnterpriseService) InitialConfig(ctx context.Context, license, password // License gets the current license information for the GitHub Enterprise instance. // +// NOTE: The GitHub documentation incorrectly shows the return type as a list ([{...}]), +// but the actual response is a single object ({...}). +// TODO: Remove this note once GitHub corrects the schema documentation. +// // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information // //meta:operation GET /manage/v1/config/license -// Current Docs shouw incorrect return type. They list as [{...}] but actual is {...} -// TODO: Remove comment after github updates schema documentation func (s *EnterpriseService) License(ctx context.Context) (*LicenseStatus, *Response, error) { u := "manage/v1/config/license" req, err := s.client.NewRequest(ctx, "GET", u, nil) From 60b33bdd49cf97ce11e9de7127668037dd12a557 Mon Sep 17 00:00:00 2001 From: Krisztian Banhidy Date: Tue, 16 Jun 2026 13:23:50 +0300 Subject: [PATCH 5/8] fix: Fix lint findings. --- github/enterprise_manage_ghes_config.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index ba042cc6087..74076f7b174 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -70,8 +70,8 @@ type InitialConfigOptions struct { } // LicenseStatus is a struct to hold the response from the License API. -// SupportKey is documented as string but is actual a bool. -// TODO: Remove comment after github updates schema documentation +// SupportKey is documented as a string, but the actual response is a bool. +// TODO: Remove this note once GitHub corrects the schema documentation. type LicenseStatus struct { AdvancedSecurityEnabled *bool `json:"advancedSecurityEnabled,omitempty"` AdvancedSecuritySeats *int `json:"advancedSecuritySeats,omitempty"` @@ -89,9 +89,7 @@ type LicenseStatus struct { ReferenceNumber *string `json:"referenceNumber,omitempty"` Seats *int `json:"seats,omitempty"` SSHAllowed *bool `json:"sshAllowed,omitempty"` - // SupportKey is documented as a string, but the actual response is a bool. - // TODO: Remove this note once GitHub corrects the schema documentation. - SupportKey *bool `json:"supportKey,omitempty"` + SupportKey *bool `json:"supportKey,omitempty"` UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` } From c9345298a1ca2c3f684f2637a203f5de2655d642 Mon Sep 17 00:00:00 2001 From: Krisztian Banhidy Date: Tue, 16 Jun 2026 14:22:08 +0300 Subject: [PATCH 6/8] fix: fix for lint output --- github/enterprise_manage_ghes_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index 74076f7b174..aefa48461b0 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -89,7 +89,7 @@ type LicenseStatus struct { ReferenceNumber *string `json:"referenceNumber,omitempty"` Seats *int `json:"seats,omitempty"` SSHAllowed *bool `json:"sshAllowed,omitempty"` - SupportKey *bool `json:"supportKey,omitempty"` + SupportKey *bool `json:"supportKey,omitempty"` UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` } From 75b91896d26d7bc96957b8542d35282e1f944c38 Mon Sep 17 00:00:00 2001 From: Krisztian Banhidy Date: Tue, 16 Jun 2026 16:09:48 +0300 Subject: [PATCH 7/8] fix: revert note location --- github/enterprise_manage_ghes_config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index aefa48461b0..3a01d576fcb 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -70,8 +70,6 @@ type InitialConfigOptions struct { } // LicenseStatus is a struct to hold the response from the License API. -// SupportKey is documented as a string, but the actual response is a bool. -// TODO: Remove this note once GitHub corrects the schema documentation. type LicenseStatus struct { AdvancedSecurityEnabled *bool `json:"advancedSecurityEnabled,omitempty"` AdvancedSecuritySeats *int `json:"advancedSecuritySeats,omitempty"` @@ -89,6 +87,8 @@ type LicenseStatus struct { ReferenceNumber *string `json:"referenceNumber,omitempty"` Seats *int `json:"seats,omitempty"` SSHAllowed *bool `json:"sshAllowed,omitempty"` + // SupportKey is documented as a string, but the actual response is a bool. + // TODO: Remove this note once GitHub corrects the schema documentation. SupportKey *bool `json:"supportKey,omitempty"` UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` } From aefc4727d85264157ec53d476257d8c693efd057 Mon Sep 17 00:00:00 2001 From: "krisztian@peak.com" Date: Tue, 16 Jun 2026 17:47:43 +0300 Subject: [PATCH 8/8] fix: run fmt.sh --- github/enterprise_manage_ghes_config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index 3a01d576fcb..556934889de 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -89,8 +89,8 @@ type LicenseStatus struct { SSHAllowed *bool `json:"sshAllowed,omitempty"` // SupportKey is documented as a string, but the actual response is a bool. // TODO: Remove this note once GitHub corrects the schema documentation. - SupportKey *bool `json:"supportKey,omitempty"` - UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` + SupportKey *bool `json:"supportKey,omitempty"` + UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` } // UploadLicenseOptions is a struct to hold the options for the UploadLicense API.