https://github.com/python/cpython/commit/319acf3d6cb05f5429422fda5c15bbd64fe9bd28
commit: 319acf3d6cb05f5429422fda5c15bbd64fe9bd28
branch: main
author: Hugo van Kemenade <1324225+hug...@users.noreply.github.com>
committer: hugovk <1324225+hug...@users.noreply.github.com>
date: 2025-05-15T16:10:56+03:00
summary:

gh-133410: Fix PR detection in build workflow (#133671)

files:
M .github/workflows/reusable-context.yml
M Tools/build/compute-changes.py

diff --git a/.github/workflows/reusable-context.yml 
b/.github/workflows/reusable-context.yml
index 73dc254edc5fbc..d2668ddcac1a3d 100644
--- a/.github/workflows/reusable-context.yml
+++ b/.github/workflows/reusable-context.yml
@@ -97,6 +97,7 @@ jobs:
       run: python Tools/build/compute-changes.py
       env:
         GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
+        GITHUB_EVENT_NAME: ${{ github.event_name }}
         CCF_TARGET_REF: ${{ github.base_ref || 
github.event.repository.default_branch }}
         CCF_HEAD_REF: ${{ github.event.pull_request.head.sha || github.sha }}
 
diff --git a/Tools/build/compute-changes.py b/Tools/build/compute-changes.py
index cfdd55fd1925fd..b5993d29b92972 100644
--- a/Tools/build/compute-changes.py
+++ b/Tools/build/compute-changes.py
@@ -57,7 +57,7 @@ class Outputs:
 
 def compute_changes() -> None:
     target_branch, head_ref = git_refs()
-    if target_branch and head_ref:
+    if os.environ.get("GITHUB_EVENT_NAME", "") == "pull_request":
         # Getting changed files only makes sense on a pull request
         files = get_changed_files(target_branch, head_ref)
         outputs = process_changed_files(files)

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to