https://github.com/python/cpython/commit/ecf9971c97ef5038be05f6ca0a979951b4b1bc3e
commit: ecf9971c97ef5038be05f6ca0a979951b4b1bc3e
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: sobolevn <[email protected]>
date: 2024-08-14T12:32:42Z
summary:

[3.12] gh-122965: Fix `reusable-change-detection.yml` on `workflow_dispatch` 
(GH-122966) (#123009)

gh-122965: Fix `reusable-change-detection.yml` on `workflow_dispatch` 
(GH-122966)
(cherry picked from commit 6ae942f412492b840fc6b43d39ba9133aa890ee7)

Co-authored-by: sobolevn <[email protected]>

files:
M .github/workflows/reusable-change-detection.yml
M .github/workflows/reusable-docs.yml

diff --git a/.github/workflows/reusable-change-detection.yml 
b/.github/workflows/reusable-change-detection.yml
index 25c789d335efc8..6f599f75547ceb 100644
--- a/.github/workflows/reusable-change-detection.yml
+++ b/.github/workflows/reusable-change-detection.yml
@@ -126,13 +126,18 @@ jobs:
           .github/workflows/reusable-docs.yml
         format: csv  # works for paths with spaces
     - name: Check for docs changes
+      # We only want to run this on PRs when related files are changed,
+      # or when user triggers manual workflow run.
       if: >-
-        github.event_name == 'pull_request'
-        && steps.changed-docs-files.outputs.added_modified_renamed != ''
+        (
+          github.event_name == 'pull_request'
+          && steps.changed-docs-files.outputs.added_modified_renamed != ''
+        ) || github.event_name == 'workflow_dispatch'
       id: docs-changes
       run: |
         echo "run-docs=true" >> "${GITHUB_OUTPUT}"
     - name: Get a list of the MSI installer-related files
+      if: github.event_name == 'pull_request'
       id: changed-win-msi-files
       uses: Ana06/[email protected]
       with:
@@ -141,10 +146,13 @@ jobs:
           .github/workflows/reusable-windows-msi.yml
         format: csv  # works for paths with spaces
     - name: Check for changes in MSI installer-related files
+      # We only want to run this on PRs when related files are changed,
+      # or when user triggers manual workflow run.
       if: >-
-        steps.changed-win-msi-files.outputs.added_modified_renamed != ''
+        (
+          github.event_name == 'pull_request'
+          && steps.changed-win-msi-files.outputs.added_modified_renamed != ''
+        ) || github.event_name == 'workflow_dispatch'
       id: win-msi-changes
       run: |
         echo "run-win-msi=true" >> "${GITHUB_OUTPUT}"
-
-...
diff --git a/.github/workflows/reusable-docs.yml 
b/.github/workflows/reusable-docs.yml
index 859f78d043ba92..4b384f4b3fa602 100644
--- a/.github/workflows/reusable-docs.yml
+++ b/.github/workflows/reusable-docs.yml
@@ -25,9 +25,15 @@ jobs:
     - name: 'Check out latest PR branch commit'
       uses: actions/checkout@v4
       with:
-        ref: ${{ github.event.pull_request.head.sha }}
+        ref: >-
+          ${{
+            github.event_name == 'pull_request'
+            && github.event.pull_request.head.sha
+            || ''
+          }}
     # Adapted from 
https://github.com/actions/checkout/issues/520#issuecomment-1167205721
     - name: 'Fetch commits to get branch diff'
+      if: github.event_name == 'pull_request'
       run: |
         # Fetch enough history to find a common ancestor commit (aka 
merge-base):
         git fetch origin ${{ env.refspec_pr }} --depth=$(( ${{ 
github.event.pull_request.commits }} + 1 )) \

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to