Skip to content

Commit

Permalink
fix: don't pass auth token in getFilteredVersions with BAZELISK_GITHU…
Browse files Browse the repository at this point in the history
…B_TOKEN is unset (#412)
  • Loading branch information
gregmagolan authored Feb 1, 2023
1 parent e133dc4 commit 6a85146
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion repositories/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ func (gh *GitHubRepo) getFilteredVersions(bazeliskHome, bazelFork string, wantPr
}

url := fmt.Sprintf("https://api.github.com/repos/%s/bazel/releases", bazelFork)
releasesJSON, err := httputil.MaybeDownload(bazeliskHome, url, bazelFork+"-releases.json", "list of Bazel releases from github.com/"+bazelFork, fmt.Sprintf("token %s", gh.token), merger)
auth := ""
if gh.token != "" {
auth = fmt.Sprintf("token %s", gh.token)
}
releasesJSON, err := httputil.MaybeDownload(bazeliskHome, url, bazelFork+"-releases.json", "list of Bazel releases from github.com/"+bazelFork, auth, merger)
if err != nil {
return []string{}, fmt.Errorf("unable to determine '%s' releases: %v", bazelFork, err)
}
Expand Down

0 comments on commit 6a85146

Please sign in to comment.