github_utils: use exact-match ref lookup in get_bucket_sha (#37813)

The plural `git/refs/heads/{bucket}` endpoint does prefix matching
and returns a list when multiple refs share the prefix, which makes
`r.json()['object']` raise TypeError. Switch to the singular
`git/ref/heads/{bucket}` endpoint so we only match the exact bucket
and get a clean 404 otherwise.
This commit is contained in:
Harald Schäfer
2026-04-12 15:30:29 -04:00
committed by GitHub
parent b930f5c3f1
commit f83b749ec2

View File

@@ -62,7 +62,7 @@ class GithubUtils:
self.api_call(github_path, data=data, method=HTTPMethod.POST, data_call=True)
def get_bucket_sha(self, bucket):
github_path = f"git/refs/heads/{bucket}"
github_path = f"git/ref/heads/{bucket}"
r = self.api_call(github_path, data_call=True, raise_on_failure=False)
return r.json()['object']['sha'] if r.ok else None