From 94de2543ae345bae165b25ccce2c8a43b3b971f7 Mon Sep 17 00:00:00 2001 From: Meredith Howard Date: Wed, 16 Sep 2026 12:25:43 -0500 Subject: [PATCH] fix(github/connector_app): use single installation transport for better token caching --- pkg/sources/github/connector_app.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/sources/github/connector_app.go b/pkg/sources/github/connector_app.go index d0f8f5035..bffcedc3a 100644 --- a/pkg/sources/github/connector_app.go +++ b/pkg/sources/github/connector_app.go @@ -154,17 +154,17 @@ func (c *appConnector) Clone(ctx context.Context, repoURL string, args ...string return "", nil, fmt.Errorf("no GitHub App installation resolved for repo %q; set githubApp.installationId to a fallback installation to scan repos outside installation listings (e.g. member repos with scanUsers) together with scanAllInstallations", repoURL) } - // TODO: Check rate limit for this call. - token, _, err := c.installationClient.Apps.CreateInstallationToken( - ctx, - installID, - &github.InstallationTokenOptions{}, - ) + clients, err := c.clientsForInstallation(installID) + if err != nil { + return "", nil, fmt.Errorf("could not prepare github clients for installation %d: %w", installID, err) + } + + token, err := clients.transport.Token(ctx) if err != nil { return "", nil, fmt.Errorf("could not create installation token for installation %d: %w", installID, err) } - return git.CloneRepoUsingToken(ctx, token.GetToken(), repoURL, "", "x-access-token", true, args...) + return git.CloneRepoUsingToken(ctx, token, repoURL, "", "x-access-token", true, args...) } // installationIDForRepo returns the mapped installation ID for repoURL. When no