@@ -136,9 +136,17 @@ jobs:
136
136
}
137
137
"baseBranch=$mainBranch" | Tee-Object $env:GITHUB_OUTPUT -Append
138
138
"prBranch=$prBranch" | Tee-Object $env:GITHUB_OUTPUT -Append
139
+ $nonBotCommits = ${{ runner.temp }}/ghwf/updater/scripts/nonbot-commits.ps1 `
140
+ -RepoUrl "$(git config --get remote.origin.url)" -PrBranch $prBranch -MainBranch $mainBranch
141
+ $changed = $nonBotCommits.Length -gt 0 ? 'true' : 'false'
142
+ "changed=$changed" | Tee-Object $env:GITHUB_OUTPUT -Append
143
+ if ("$changed" -eq "true")
144
+ {
145
+ Write-Output "::warning::Target branch '$prBranch' has been changed manually - skipping updater to avoid overwriting these changes."
146
+ }
139
147
140
148
- name : Fetch an existing PR
141
- if : steps.target.outputs.latestTag != steps.target.outputs.originalTag
149
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
142
150
uses : octokit/request-action@89a1754fe82ca777b044ca8e79e9881a42f15a93 # v2.1.7
143
151
id : existing-pr-request
144
152
with :
@@ -149,7 +157,7 @@ jobs:
149
157
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
150
158
151
159
- name : Parse the existing PR URL
152
- if : steps.target.outputs.latestTag != steps.target.outputs.originalTag
160
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
153
161
id : existing-pr
154
162
run : |
155
163
$data = @'
@@ -173,10 +181,10 @@ jobs:
173
181
}
174
182
175
183
- run : git --no-pager diff
176
- if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') }}
184
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }}
177
185
178
186
- name : Get target changelog
179
- if : steps.target.outputs.latestTag != steps.target.outputs.originalTag
187
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
180
188
run : |
181
189
$changelog = ${{ runner.temp }}/ghwf/updater/scripts/get-changelog.ps1 `
182
190
-RepoUrl '${{ steps.target.outputs.url }}' `
@@ -186,7 +194,7 @@ jobs:
186
194
187
195
# First we create a PR only if it doesn't exist. We will later overwrite the content with the same action.
188
196
- name : Create a PR
189
- if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') }}
197
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }}
190
198
uses : peter-evans/create-pull-request@b4d51739f96fca8047ad065eccef63442d8e99f7 # pin#v4
191
199
id : create-pr
192
200
with :
@@ -204,7 +212,7 @@ jobs:
204
212
# draft: true
205
213
206
214
- name : Verify we have a PR
207
- if : steps.target.outputs.latestTag != steps.target.outputs.originalTag
215
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
208
216
id : pr
209
217
run : |
210
218
if ('${{ steps.create-pr.outputs.pull-request-url }}' -ne '')
@@ -223,17 +231,17 @@ jobs:
223
231
# If we had to create a new PR, we must do a clean checkout & update the submodule again.
224
232
# If we didn't do this, the new PR would only have a changelog...
225
233
- name : ' After new PR: restore repo'
226
- if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') }}
234
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }}
227
235
uses : actions/checkout@v3
228
236
with :
229
237
ssh-key : ${{ secrets.api-token }}
230
238
231
239
- name : ' After new PR: redo the update'
232
- if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') }}
240
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }}
233
241
run : ${{ runner.temp }}/ghwf/updater/scripts/update-dependency.ps1 -Path '${{ inputs.path }}' -Tag '${{ steps.target.outputs.latestTag }}'
234
242
235
243
- name : Update Changelog
236
- if : ${{ inputs.changelog-entry && ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) }}
244
+ if : ${{ inputs.changelog-entry && ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
237
245
run : |
238
246
${{ runner.temp }}/ghwf/updater/scripts/update-changelog.ps1 `
239
247
-Name '${{ inputs.name }}' `
@@ -245,11 +253,11 @@ jobs:
245
253
-Section '${{ inputs.changelog-section }}'
246
254
247
255
- run : git --no-pager diff
248
- if : steps.target.outputs.latestTag != steps.target.outputs.originalTag
256
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
249
257
250
258
# Now make the PR in its final state. This way we only have one commit and no updates if there are no changes between runs.
251
259
- name : Update the PR
252
- if : steps.target.outputs.latestTag != steps.target.outputs.originalTag
260
+ if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
253
261
uses : peter-evans/create-pull-request@b4d51739f96fca8047ad065eccef63442d8e99f7
254
262
with :
255
263
base : ${{ steps.root.outputs.baseBranch }}
0 commit comments