Provisioning: fix authorized github client initialization (#108290)

* Add logging

* Fix the condition for the github token

* Revert "Add logging"

This reverts commit 71cbc675f6.

* Fix condition
This commit is contained in:
Roberto Jiménez Sánchez
2025-07-18 10:23:55 +02:00
committed by GitHub
parent ca1ecf0764
commit 5cf48294f7
@@ -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))
}