Skip to content

Commit

Permalink
Merge pull request #16485 from github/oscarsj/fix-lfs-probe-auth-in-cs
Browse files Browse the repository at this point in the history
make sure GITHUB_TOKEN exists and is not empty before using it in auth headers
  • Loading branch information
oscarsj authored May 14, 2024
2 parents a62ce4c + 9105faa commit e65a62c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion misc/bazel/internal/git_lfs_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def get_endpoint():
# see https://github.com/actions/checkout/blob/44c2b7a8a4ea60a981eaca3cf939b5f4305c123b/src/git-auth-helper.ts#L56-L63
auth = git("config", f"http.{url.scheme}://{url.netloc}/.extraheader")
endpoint.update_headers(get_env(auth, sep=": "))
if "GITHUB_TOKEN" in os.environ:
if os.environ.get("GITHUB_TOKEN"):
endpoint.headers["Authorization"] = f"token {os.environ['GITHUB_TOKEN']}"
if "Authorization" not in endpoint.headers:
# last chance: use git credentials (possibly backed by a credential helper like the one installed by gh)
Expand Down

0 comments on commit e65a62c

Please sign in to comment.