Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Fix: Check for git authentication when GITHUB_TOKEN exists #463

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/github/githubutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@
gh = github.NewClient(oauth2.NewClient(context.Background(), oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")},
)))
} else {
if _, err := ListReleases(flyte, gh.Repositories); err != nil {
logger.Warnf(context.Background(), "Found GITHUB_TOKEN but failed to fetch releases. Using empty http.Client: %s.", err)
gh = nil
}

Check warning on line 237 in pkg/github/githubutil.go

View check run for this annotation

Codecov / codecov/patch

pkg/github/githubutil.go#L234-L237

Added lines #L234 - L237 were not covered by tests
}
if gh == nil {

Check warning on line 239 in pkg/github/githubutil.go

View check run for this annotation

Codecov / codecov/patch

pkg/github/githubutil.go#L239

Added line #L239 was not covered by tests
gh = github.NewClient(&http.Client{})
}
return gh.Repositories
Expand Down
Loading