Skip to content

Commit

Permalink
fix(CI): ensure request to Github API are authenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
esolitos authored and gitbutler-client committed Aug 23, 2024
1 parent 97c7841 commit c40dcc4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/go/cond_make.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,16 @@ func latestReleasedTag(mirror string) (string, error) {
switch mirror {
case "github":
url := "https://api.github.com/repos/vespa-engine/vespa/releases/latest"
resp, err := http.Get(url)
token := "Bearer " + os.Getenv("GH_TOKEN")

req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Println("Error on setting up http request.\n[ERROR] -", err)
}
req.Header.Add("Authorization", token)

client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return "", err
}
Expand All @@ -100,6 +109,7 @@ func latestReleasedTag(mirror string) (string, error) {
return "", err
}
return release.TagName, nil

case "homebrew":
cmd, stdout, _ := newCmd("brew", "info", "--json", "--formula", "vespa-cli")
cmd.Stdout = stdout // skip printing output to os.Stdout
Expand Down

0 comments on commit c40dcc4

Please sign in to comment.