Support bazel-diff for GitHub PR presubmit (#1883)
Fixes
https://buildkite.com/bazel/bazel-bazel-github-presubmit/builds/20257
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index ac78bf2..57e67f3 100755
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -2445,7 +2445,13 @@
def get_commit_archive_url(resolved_diffbase):
- repo_url = os.getenv("BUILDKITE_REPO", "")
+ # If this is a GitHub pull request presubmit
+ repo_url = os.getenv("BUILDKITE_PULL_REQUEST_REPO", "")
+
+ # If this is a Google presubmit, BUILDKITE_PULL_REQUEST_REPO is not set, fallback to BUILDKITE_REPO
+ if not repo_url:
+ repo_url = os.getenv("BUILDKITE_REPO", "")
+
prefix = "+" if "googlesource" in repo_url else ""
return repo_url.replace(".git", "/{}archive/{}.tar.gz".format(prefix, resolved_diffbase))