Skip to content

Commit de39a77

Browse files
committed
Fix init_go_test hitting GitHub API rate limit in CI
Pin init_go_test to --version v1.29.0, matching how the python and cc plugin init tests already avoid the GitHub API. Also add GITHUB_TOKEN support to getLatestRevision() so unauthenticated rate limits (60/hr) don't break CI when the API is hit for real.
1 parent 53ff948 commit de39a77

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/plzinit/plugins.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ func getLatestRevision(plugin string) (string, error) {
253253
return "", err
254254
}
255255
req.Header.Set("accept", "application/vnd.github.v3+json")
256+
if token := os.Getenv("GITHUB_TOKEN"); token != "" {
257+
req.Header.Set("Authorization", "token "+token)
258+
}
256259
client := &http.Client{}
257260
resp, err := client.Do(req)
258261
if err != nil {

test/plugins/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ plugin_e2e_test(
9191
"go.conf": "//third_party/go:toolchain|go\n//third_party/go:std",
9292
},
9393
# Need to break hard link here so init_plugin_test's actual .plzconfig doesn't get updated.
94-
plz_command = "cp .plzconfig .foo; mv .foo .plzconfig; plz init plugin go && plz query config plugin.go.gotool > go.conf && plz query config plugin.go.stdlib >> go.conf",
94+
plz_command = "cp .plzconfig .foo; mv .foo .plzconfig; plz init plugin go --version v1.29.0 && plz query config plugin.go.gotool > go.conf && plz query config plugin.go.stdlib >> go.conf",
9595
)
9696

9797
# Test that the target is created in plugins/BUILD

0 commit comments

Comments
 (0)