@@ -131,7 +131,8 @@ jobs:
131
131
echo "Base branch: ${{ needs.new-branch.outputs.base }}"
132
132
echo "Working branch: ${{ needs.new-branch.outputs.working }}"
133
133
134
- - uses : actions/checkout@v4
134
+ - name : Checkout
135
+ uses : actions/checkout@v4
135
136
with :
136
137
ref : ${{ needs.new-branch.outputs.working }}
137
138
@@ -224,11 +225,49 @@ jobs:
224
225
echo "Pushed: ${{ steps.commit.outputs.pushed }}"
225
226
echo "SHA: ${{ steps.commit.outputs.commit_sha }}"
226
227
228
+ changes :
229
+ name : Changes
230
+ needs : [new-branch, pre-gen]
231
+ runs-on : ubuntu-latest
232
+ steps :
233
+ - name : Checkout
234
+ uses : actions/checkout@v4
235
+ with :
236
+ ref : ${{ needs.new-branch.outputs.working }}
237
+ fetch-depth : 10
238
+
239
+ # Maybe better just checkout and then
240
+ # git rev-list --ancestry-path ${{ needs.new-branch.outputs.base || github.event.repository.default_branch }}..${{ needs.new-branch.outputs.working }}
241
+ # It's faster, simplier and less deps.
242
+ - name : Changes
243
+ id : changes
244
+ continue-on-error : true
245
+ uses : tj-actions/changed-files@v44
246
+ with :
247
+ skip_initial_fetch : " false"
248
+ sha : ${{ needs.new-branch.outputs.working }}
249
+ base_sha : ${{ needs.new-branch.outputs.base || github.event.repository.default_branch }}
250
+
251
+ - name : List changed files
252
+ if : steps.changes.outcome == 'success'
253
+ env :
254
+ ALL_CHANGED_FILES : ${{ steps.changes.outputs.all_changed_files }}
255
+ run : |
256
+ for file in ${ALL_CHANGED_FILES}; do
257
+ echo "$file was changed"
258
+ done
259
+
260
+ outputs :
261
+ changes : ${{ steps.changes.outputs.all_changed_files }}
262
+ changed : ${{ steps.changes.outputs.all_changed_files && 'true' || ' ' }}
263
+
264
+
227
265
bump :
228
266
name : Bump
229
- needs : [new-branch, pre-gen]
267
+ needs : [new-branch, pre-gen, changes ]
230
268
runs-on : ubuntu-latest
231
269
continue-on-error : true # Workspaces are not supported yet
270
+ if : needs.changes.outputs.changed == 'true'
232
271
defaults :
233
272
run :
234
273
shell : bash
@@ -307,7 +346,8 @@ jobs:
307
346
308
347
tests :
309
348
name : Tests
310
- needs : [new-branch, pre-gen]
349
+ needs : [new-branch, pre-gen, changes]
350
+ if : needs.changes.outputs.changed == 'true'
311
351
uses : ./.github/workflows/tests.yml
312
352
secrets : inherit
313
353
permissions :
0 commit comments