From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Thu, 15 May 2025 13:10:56 +0000 (+0300) Subject: gh-133410: Fix PR detection in build workflow (#133671) X-Git-Tag: v3.15.0a1~1713 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=319acf3d6cb05f5429422fda5c15bbd64fe9bd28;p=thirdparty%2FPython%2Fcpython.git gh-133410: Fix PR detection in build workflow (#133671) --- diff --git a/.github/workflows/reusable-context.yml b/.github/workflows/reusable-context.yml index 73dc254edc5f..d2668ddcac1a 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 cfdd55fd1925..b5993d29b929 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)