From 53ef4d0e88fe08f3c9dfa305cbe1cff4ecb521ac Mon Sep 17 00:00:00 2001 From: Tristan Partin Date: Wed, 17 Jun 2026 19:48:02 +0000 Subject: [PATCH v1 6/7] Check that GITHUB_OUTPUT exists before trying to append to it Without defining GITHUB_OUTPUT as an environment variable before testing the script, it would error out with an undefined variable. This will improve local development a bit. Signed-off-by: Tristan Partin --- src/tools/ci/gha_ccache_decide.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tools/ci/gha_ccache_decide.py b/src/tools/ci/gha_ccache_decide.py index fe9db62891..1b58990939 100644 --- a/src/tools/ci/gha_ccache_decide.py +++ b/src/tools/ci/gha_ccache_decide.py @@ -6,6 +6,8 @@ import subprocess from contextlib import contextmanager +GITHUB_OUTPUT = os.environ.get("GITHUB_OUTPUT") + def run(cmd, check=True): return subprocess.run( cmd, @@ -16,9 +18,9 @@ def run(cmd, check=True): ).stdout def append_github_output(key, value): - output_path = os.environ["GITHUB_OUTPUT"] - with open(output_path, "a", encoding="utf-8") as f: - f.write(f"{key}={value}\n") + if GITHUB_OUTPUT: + with open(GITHUB_OUTPUT, "a", encoding="utf-8") as f: + f.write(f"{key}={value}\n") @contextmanager def group(name): -- Tristan Partin https://tristan.partin.io