@@ -708,6 +708,29 @@ The format of the version string is as follows:
708
708
709
709
</details >
710
710
711
+ <details >
712
+ <summary >Get all changed files without escaping unsafe filename characters</summary >
713
+
714
+ ``` yaml
715
+ ...
716
+ - name : Get changed files
717
+ id : changed-files
718
+ uses : tj-actions/changed-files@v40
719
+ with :
720
+ safe_output : false # set to false because we are using an environment variable to store the output and avoid command injection.
721
+
722
+ - name : List all added files
723
+ env :
724
+ ADDED_FILES : ${{ steps.changed-files.outputs.added_files }}
725
+ run : |
726
+ for file in "$ADDED_FILES"; do
727
+ echo "$file was added"
728
+ done
729
+ ...
730
+ ```
731
+
732
+ </details >
733
+
711
734
<details >
712
735
<summary >Get all changed files and use a comma separator</summary >
713
736
@@ -733,13 +756,10 @@ See [inputs](#inputs) for more information.
733
756
- name : Get changed files
734
757
id : changed-files
735
758
uses : tj-actions/changed-files@v40
736
- with :
737
- safe_output : false
738
759
739
760
- name : List all added files
740
761
env :
741
- ADDED_FILES : |-
742
- ${{ steps.changed-files.outputs.added_files }}
762
+ ADDED_FILES : ${{ steps.changed-files.outputs.added_files }}
743
763
run : |
744
764
for file in "$ADDED_FILES"; do
745
765
echo "$file was added"
@@ -759,8 +779,6 @@ See [outputs](#outputs) for a list of all available outputs.
759
779
- name : Get changed files
760
780
id : changed-files
761
781
uses : tj-actions/changed-files@v40
762
- with :
763
- safe_output : false
764
782
765
783
- name : Run a step if my-file.txt was modified
766
784
if : contains(steps.changed-files.outputs.modified_files, 'my-file.txt')
@@ -783,7 +801,6 @@ See [outputs](#outputs) for a list of all available outputs.
783
801
id : changed-files-write-output-files-txt
784
802
uses : tj-actions/changed-files@v40
785
803
with :
786
- safe_output : false
787
804
write_output_files : true
788
805
789
806
- name : Verify the contents of the .github/outputs/added_files.txt file
@@ -803,7 +820,6 @@ See [outputs](#outputs) for a list of all available outputs.
803
820
id : changed-files-write-output-files-json
804
821
uses : tj-actions/changed-files@v40
805
822
with :
806
- safe_output : false
807
823
json : true
808
824
write_output_files : true
809
825
@@ -847,7 +863,6 @@ See [inputs](#inputs) for more information.
847
863
id : changed-files-specific
848
864
uses : tj-actions/changed-files@v40
849
865
with :
850
- safe_output : false
851
866
files : |
852
867
my-file.txt
853
868
*.sh
@@ -869,8 +884,7 @@ See [inputs](#inputs) for more information.
869
884
- name : Run step if any of the listed files above is deleted
870
885
if : steps.changed-files-specific.outputs.any_deleted == 'true'
871
886
env :
872
- DELETED_FILES : |-
873
- ${{ steps.changed-files-specific.outputs.deleted_files }}
887
+ DELETED_FILES : ${{ steps.changed-files-specific.outputs.deleted_files }}
874
888
run : |
875
889
for file in "$DELETED_FILES"; do
876
890
echo "$file was deleted"
@@ -879,8 +893,7 @@ See [inputs](#inputs) for more information.
879
893
- name : Run step if all listed files above have been deleted
880
894
if : steps.changed-files-specific.outputs.only_deleted == 'true'
881
895
env :
882
- DELETED_FILES : |-
883
- ${{ steps.changed-files-specific.outputs.deleted_files }}
896
+ DELETED_FILES : ${{ steps.changed-files-specific.outputs.deleted_files }}
884
897
run : |
885
898
for file in "$DELETED_FILES"; do
886
899
echo "$file was deleted"
@@ -992,15 +1005,13 @@ jobs:
992
1005
id : changed-files-specific
993
1006
uses : tj-actions/changed-files@v40
994
1007
with :
995
- safe_output : false
996
1008
base_sha : ${{ steps.get-base-sha.outputs.base_sha }}
997
1009
files : .github/**
998
1010
999
1011
- name : Run step if any file(s) in the .github folder change
1000
1012
if : steps.changed-files-specific.outputs.any_changed == 'true'
1001
1013
env :
1002
- ALL_CHANGED_FILES : |-
1003
- ${{ steps.changed-files-specific.outputs.all_changed_files }}
1014
+ ALL_CHANGED_FILES : ${{ steps.changed-files-specific.outputs.all_changed_files }}
1004
1015
run : |
1005
1016
echo "One or more files in the .github folder has changed."
1006
1017
echo "List all the files that have changed: $ALL_CHANGED_FILES"
@@ -1026,7 +1037,6 @@ See [inputs](#inputs) for more information.
1026
1037
id : changed-files-for-dir1
1027
1038
uses : tj-actions/changed-files@v40
1028
1039
with :
1029
- safe_output : false
1030
1040
path : dir1
1031
1041
1032
1042
- name : List all added files in dir1
0 commit comments