Skip to content

Commit 6ae942f

Browse files
authored
gh-122965: Fix reusable-change-detection.yml on workflow_dispatch (#122966)
1 parent eec7bda commit 6ae942f

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

.github/workflows/reusable-change-detection.yml

+13-5
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,18 @@ jobs:
126126
.github/workflows/reusable-docs.yml
127127
format: csv # works for paths with spaces
128128
- name: Check for docs changes
129+
# We only want to run this on PRs when related files are changed,
130+
# or when user triggers manual workflow run.
129131
if: >-
130-
github.event_name == 'pull_request'
131-
&& steps.changed-docs-files.outputs.added_modified_renamed != ''
132+
(
133+
github.event_name == 'pull_request'
134+
&& steps.changed-docs-files.outputs.added_modified_renamed != ''
135+
) || github.event_name == 'workflow_dispatch'
132136
id: docs-changes
133137
run: |
134138
echo "run-docs=true" >> "${GITHUB_OUTPUT}"
135139
- name: Get a list of the MSI installer-related files
140+
if: github.event_name == 'pull_request'
136141
id: changed-win-msi-files
137142
uses: Ana06/[email protected]
138143
with:
@@ -141,10 +146,13 @@ jobs:
141146
.github/workflows/reusable-windows-msi.yml
142147
format: csv # works for paths with spaces
143148
- name: Check for changes in MSI installer-related files
149+
# We only want to run this on PRs when related files are changed,
150+
# or when user triggers manual workflow run.
144151
if: >-
145-
steps.changed-win-msi-files.outputs.added_modified_renamed != ''
152+
(
153+
github.event_name == 'pull_request'
154+
&& steps.changed-win-msi-files.outputs.added_modified_renamed != ''
155+
) || github.event_name == 'workflow_dispatch'
146156
id: win-msi-changes
147157
run: |
148158
echo "run-win-msi=true" >> "${GITHUB_OUTPUT}"
149-
150-
...

.github/workflows/reusable-docs.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ jobs:
2525
- name: 'Check out latest PR branch commit'
2626
uses: actions/checkout@v4
2727
with:
28-
ref: ${{ github.event.pull_request.head.sha }}
28+
ref: >-
29+
${{
30+
github.event_name == 'pull_request'
31+
&& github.event.pull_request.head.sha
32+
|| ''
33+
}}
2934
# Adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
3035
- name: 'Fetch commits to get branch diff'
36+
if: github.event_name == 'pull_request'
3137
run: |
3238
# Fetch enough history to find a common ancestor commit (aka merge-base):
3339
git fetch origin ${{ env.refspec_pr }} --depth=$(( ${{ github.event.pull_request.commits }} + 1 )) \

0 commit comments

Comments
 (0)