From 176e4ed2abdaada8efed9c0eb3b4a2d85f2cd48a Mon Sep 17 00:00:00 2001 From: nrainer-materialize <129728240+nrainer-materialize@users.noreply.github.com> Date: Thu, 16 Nov 2023 14:08:19 +0100 Subject: [PATCH] ci: fix PR detection (#23235) --- misc/python/materialize/buildkite.py | 3 ++- misc/python/materialize/ui.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/misc/python/materialize/buildkite.py b/misc/python/materialize/buildkite.py index c95c257034190..3473205f504e3 100644 --- a/misc/python/materialize/buildkite.py +++ b/misc/python/materialize/buildkite.py @@ -38,7 +38,8 @@ def is_in_pull_request() -> bool: def is_pull_request_marker_set() -> bool: - return ui.env_is_truthy("BUILDKITE_PULL_REQUEST") + # If set, this variable will contain either the ID of the pull request or the string "false". + return os.getenv("BUILDKITE_PULL_REQUEST", "false") != "false" def is_on_default_branch() -> bool: diff --git a/misc/python/materialize/ui.py b/misc/python/materialize/ui.py index dce8b11cbaf63..92dfefa9bcf6f 100644 --- a/misc/python/materialize/ui.py +++ b/misc/python/materialize/ui.py @@ -149,10 +149,10 @@ def shell_quote(args: Iterable[Any]) -> str: def env_is_truthy(env_var: str) -> bool: - """Return true if `env_var` is set and is not one of: 0, '', no""" + """Return true if `env_var` is set and is not one of: 0, '', no, false""" env = os.getenv(env_var) if env is not None: - return env not in ("", "0", "no") + return env not in ("", "0", "no", "false") return False