From 9500dd96ba55e96bbc0df2f2f9b6701c8ef44329 Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Fri, 28 Jun 2024 13:45:54 +0100 Subject: [PATCH] Fix local_branch() to work on GHA (#6303) --- tests/infra/github.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/infra/github.py b/tests/infra/github.py index 8b7614191..1c65c404a 100644 --- a/tests/infra/github.py +++ b/tests/infra/github.py @@ -197,12 +197,12 @@ class GitEnv: if tag_or_none: return tag_or_none - # ADO + # ADO or GHA short = None if "SYSTEM_PULLREQUEST_SOURCEBRANCH" in os.environ: short = os.environ["SYSTEM_PULLREQUEST_SOURCEBRANCH"] else: - ref = os.environ["BUILD_SOURCEBRANCH"] + ref = os.environ.get("BUILD_SOURCEBRANCH") or os.environ.get("GITHUB_REF") for prefix in ["refs/heads/", "refs/tags/", "refs/pull/"]: if ref.startswith(prefix): short = ref[len(prefix) :]