@@ -275,6 +275,113 @@ jobs:
275275 shell :
276276 bash
277277
278+ test-skip-same-base-and-commit-sha :
279+ name : Test changed-files skip same base and commit sha
280+ runs-on : ubuntu-latest
281+ needs : build
282+ if : needs.build.outputs.files_changed != 'true'
283+ permissions :
284+ contents : read
285+
286+ steps :
287+ - name : Checkout branch
288+ uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
289+ with :
290+ repository : ${{ github.event.pull_request.head.repo.full_name }}
291+ fetch-depth : 0
292+
293+ - name : Download build assets
294+ uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
295+ with :
296+ name : build-assets
297+
298+ - name : Get head SHA
299+ id : head-sha
300+ run : |
301+ echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
302+ shell :
303+ bash
304+
305+ - name : Run changed-files with same base and commit sha
306+ id : changed-files
307+ uses : ./
308+ with :
309+ base_sha : ${{ steps.head-sha.outputs.sha }}
310+ sha : ${{ steps.head-sha.outputs.sha }}
311+ skip_same_sha : true
312+
313+ - name : Verify empty outputs
314+ if : steps.changed-files.outputs.all_changed_files_count != '0' || steps.changed-files.outputs.any_changed != 'false'
315+ run : |
316+ echo "Expected empty outputs; got count=${{ steps.changed-files.outputs.all_changed_files_count }} any_changed=${{ steps.changed-files.outputs.any_changed }}"
317+ exit 1
318+ shell :
319+ bash
320+
321+ - name : Show output
322+ run : |
323+ echo '${{ toJSON(steps.changed-files.outputs) }}'
324+ shell :
325+ bash
326+
327+ test-exclude-symlinks :
328+ name : Test changed-files exclude symlinks
329+ runs-on : ubuntu-latest
330+ needs : build
331+ if : needs.build.outputs.files_changed != 'true'
332+ permissions :
333+ contents : read
334+
335+ steps :
336+ - name : Checkout branch
337+ uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
338+ with :
339+ repository : ${{ github.event.pull_request.head.repo.full_name }}
340+ fetch-depth : 0
341+
342+ - name : Download build assets
343+ uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
344+ with :
345+ name : build-assets
346+
347+ - name : Run changed-files without symlink exclusion
348+ id : changed-files-symlink-included
349+ uses : ./
350+ with :
351+ base_sha : 955f38aa4f30f1ec92d08049b26e6d736ffea013
352+ sha : ddde96a55848a649c09322c7094b22ef4b4abe23
353+
354+ - name : Verify symlink is present
355+ if : " !contains(steps.changed-files-symlink-included.outputs.added_files, 'test/symlink-to-target')"
356+ run : |
357+ echo "Expected symlink to be present in added_files; got ${{ steps.changed-files-symlink-included.outputs.added_files }}"
358+ exit 1
359+ shell :
360+ bash
361+
362+ - name : Run changed-files excluding symlinks
363+ id : changed-files-symlink-excluded
364+ uses : ./
365+ with :
366+ base_sha : 955f38aa4f30f1ec92d08049b26e6d736ffea013
367+ sha : ddde96a55848a649c09322c7094b22ef4b4abe23
368+ exclude_symlinks : true
369+
370+ - name : Verify symlink is excluded
371+ if : " contains(steps.changed-files-symlink-excluded.outputs.added_files, 'test/symlink-to-target') || contains(steps.changed-files-symlink-excluded.outputs.all_changed_files, 'test/symlink-to-target')"
372+ run : |
373+ echo "Expected symlink to be excluded; got added=${{ steps.changed-files-symlink-excluded.outputs.added_files }} all=${{ steps.changed-files-symlink-excluded.outputs.all_changed_files }}"
374+ exit 1
375+ shell :
376+ bash
377+
378+ - name : Show output
379+ run : |
380+ echo '${{ toJSON(steps.changed-files-symlink-included.outputs) }}'
381+ echo '${{ toJSON(steps.changed-files-symlink-excluded.outputs) }}'
382+ shell :
383+ bash
384+
278385 test-using-branch-names-for-base-sha-and-sha-inputs :
279386 name : Test using branch names for base_sha and sha inputs
280387 runs-on : ubuntu-latest
0 commit comments