From 5cf48294f749368b1c093657b102f81b226ebe47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Jim=C3=A9nez=20S=C3=A1nchez?= Date: Fri, 18 Jul 2025 10:23:55 +0200 Subject: [PATCH] Provisioning: fix authorized github client initialization (#108290) * Add logging * Fix the condition for the github token * Revert "Add logging" This reverts commit 71cbc675f6d258ef69adbe21b12b68786ecbdeff. * Fix condition --- pkg/registry/apis/provisioning/repository/github/factory.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/registry/apis/provisioning/repository/github/factory.go b/pkg/registry/apis/provisioning/repository/github/factory.go index da2d50a6131..6f2435ee8d0 100644 --- a/pkg/registry/apis/provisioning/repository/github/factory.go +++ b/pkg/registry/apis/provisioning/repository/github/factory.go @@ -12,6 +12,7 @@ import ( // It exists only for the ability to test the code easily. type Factory struct { // Client allows overriding the client to use in the GH client returned. It exists primarily for testing. + // FIXME: we should replace in this way. We should add some options pattern for the factory. Client *http.Client } @@ -28,7 +29,7 @@ func (r *Factory) New(ctx context.Context, ghToken string) Client { &oauth2.Token{AccessToken: ghToken}, ) - if len(ghToken) == 0 { + if len(ghToken) > 0 { tokenClient := oauth2.NewClient(ctx, tokenSrc) return NewClient(github.NewClient(tokenClient)) }