From f805e966ed984fa85016f71f748bf58652fe3a04 Mon Sep 17 00:00:00 2001 From: Frank2006x Date: Wed, 14 Oct 2026 15:27:57 +0000 Subject: [PATCH] fix: Pass integer repository IDs for Dependabot secret --- github/dependabot_secrets.go | 18 +----------------- github/dependabot_secrets_test.go | 13 +------------ 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/github/dependabot_secrets.go b/github/dependabot_secrets.go index 03d3f9e2aeb..d72b9aefca2 100644 --- a/github/dependabot_secrets.go +++ b/github/dependabot_secrets.go @@ -176,23 +176,7 @@ func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, func (s *DependabotService) CreateOrUpdateOrgSecret(ctx context.Context, org, name string, body SecretOrgRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) - var bodyOverride any = body - if len(body.SelectedRepositoryIDs) > 0 { - repoIDs := make([]string, len(body.SelectedRepositoryIDs)) - for i, id := range body.SelectedRepositoryIDs { - repoIDs[i] = fmt.Sprintf("%v", id) - } - - bodyOverride = struct { - SecretOrgRequest - SelectedRepositoryIDs []string `json:"selected_repository_ids,omitzero"` - }{ - SecretOrgRequest: body, - SelectedRepositoryIDs: repoIDs, - } - } - - req, err := s.client.NewRequest(ctx, "PUT", u, bodyOverride) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/dependabot_secrets_test.go b/github/dependabot_secrets_test.go index 86f18599af2..d6fcd384546 100644 --- a/github/dependabot_secrets_test.go +++ b/github/dependabot_secrets_test.go @@ -368,18 +368,7 @@ func TestDependabotService_CreateOrUpdateOrgSecret(t *testing.T) { mux.HandleFunc("/orgs/o/dependabot/secrets/NAME", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testHeader(t, r, "Content-Type", "application/json") - want := SecretOrgRequest{ - EncryptedValue: input.EncryptedValue, - KeyID: input.KeyID, - Visibility: input.Visibility, - } - testJSONBody(t, r, struct { - SecretOrgRequest - SelectedRepositoryIDs []string `json:"selected_repository_ids,omitempty"` - }{ - SecretOrgRequest: want, - SelectedRepositoryIDs: []string{"1296269", "1269280"}, - }) + testJSONBody(t, r, input) w.WriteHeader(http.StatusCreated) })