This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 314a166fb51 Amend empty GITHUB_BASE_REF case (#63473)
314a166fb51 is described below

commit 314a166fb5126cbc330a4afe8909815a8f434b16
Author: Bugra Ozturk <[email protected]>
AuthorDate: Thu Mar 12 20:57:06 2026 +0100

    Amend empty GITHUB_BASE_REF case (#63473)
---
 scripts/ci/prek/check_execution_api_versions.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/ci/prek/check_execution_api_versions.py 
b/scripts/ci/prek/check_execution_api_versions.py
index 3841c32c140..6ce1f5b7644 100755
--- a/scripts/ci/prek/check_execution_api_versions.py
+++ b/scripts/ci/prek/check_execution_api_versions.py
@@ -37,7 +37,7 @@ VERSIONS_PREFIX = 
"airflow-core/src/airflow/api_fastapi/execution_api/versions/"
 
 def get_changed_files_ci() -> list[str]:
     """Get changed files in a CI environment by comparing against the target 
branch."""
-    target_branch = os.environ.get("GITHUB_BASE_REF", "main")
+    target_branch = os.environ.get("GITHUB_BASE_REF") or "main"
     fetch_result = subprocess.run(
         ["git", "fetch", "origin", target_branch],
         capture_output=True,
@@ -48,8 +48,12 @@ def get_changed_files_ci() -> list[str]:
         console.print(
             f"[yellow]WARNING: Failed to fetch origin/{target_branch}: 
{fetch_result.stderr.strip()}[/]"
         )
+
+    is_main = not os.environ.get("GITHUB_BASE_REF")
+    diff_target = "HEAD~1" if is_main else f"origin/{target_branch}...HEAD"
+
     result = subprocess.run(
-        ["git", "diff", "--name-only", f"origin/{target_branch}...HEAD"],
+        ["git", "diff", "--name-only", diff_target],
         capture_output=True,
         text=True,
         check=False,

Reply via email to