]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-133410: Fix PR detection in build workflow (GH-133671) (#134057)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 15 May 2025 14:04:54 +0000 (16:04 +0200)
committerGitHub <noreply@github.com>
Thu, 15 May 2025 14:04:54 +0000 (17:04 +0300)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
.github/workflows/reusable-context.yml
Tools/build/compute-changes.py

index 73dc254edc5fbc70d11b98ccf19b6a88bdfd3d40..d2668ddcac1a3d8684fb7201154b224817350dfd 100644 (file)
@@ -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 }}
 
index cfdd55fd1925fd68c667e764ec8a72ec86684acf..b5993d29b92972fa8c59043db434d9a4a32ca19c 100644 (file)
@@ -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)