Skip to content

Commit 6e79d6e

Browse files
authored
Update README.md
1 parent d13ac19 commit 6e79d6e

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

README.md

+27-17
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,29 @@ The format of the version string is as follows:
708708

709709
</details>
710710

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+
711734
<details>
712735
<summary>Get all changed files and use a comma separator</summary>
713736

@@ -733,13 +756,10 @@ See [inputs](#inputs) for more information.
733756
- name: Get changed files
734757
id: changed-files
735758
uses: tj-actions/changed-files@v40
736-
with:
737-
safe_output: false
738759

739760
- name: List all added files
740761
env:
741-
ADDED_FILES: |-
742-
${{ steps.changed-files.outputs.added_files }}
762+
ADDED_FILES: ${{ steps.changed-files.outputs.added_files }}
743763
run: |
744764
for file in "$ADDED_FILES"; do
745765
echo "$file was added"
@@ -759,8 +779,6 @@ See [outputs](#outputs) for a list of all available outputs.
759779
- name: Get changed files
760780
id: changed-files
761781
uses: tj-actions/changed-files@v40
762-
with:
763-
safe_output: false
764782

765783
- name: Run a step if my-file.txt was modified
766784
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.
783801
id: changed-files-write-output-files-txt
784802
uses: tj-actions/changed-files@v40
785803
with:
786-
safe_output: false
787804
write_output_files: true
788805

789806
- 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.
803820
id: changed-files-write-output-files-json
804821
uses: tj-actions/changed-files@v40
805822
with:
806-
safe_output: false
807823
json: true
808824
write_output_files: true
809825

@@ -847,7 +863,6 @@ See [inputs](#inputs) for more information.
847863
id: changed-files-specific
848864
uses: tj-actions/changed-files@v40
849865
with:
850-
safe_output: false
851866
files: |
852867
my-file.txt
853868
*.sh
@@ -869,8 +884,7 @@ See [inputs](#inputs) for more information.
869884
- name: Run step if any of the listed files above is deleted
870885
if: steps.changed-files-specific.outputs.any_deleted == 'true'
871886
env:
872-
DELETED_FILES: |-
873-
${{ steps.changed-files-specific.outputs.deleted_files }}
887+
DELETED_FILES: ${{ steps.changed-files-specific.outputs.deleted_files }}
874888
run: |
875889
for file in "$DELETED_FILES"; do
876890
echo "$file was deleted"
@@ -879,8 +893,7 @@ See [inputs](#inputs) for more information.
879893
- name: Run step if all listed files above have been deleted
880894
if: steps.changed-files-specific.outputs.only_deleted == 'true'
881895
env:
882-
DELETED_FILES: |-
883-
${{ steps.changed-files-specific.outputs.deleted_files }}
896+
DELETED_FILES: ${{ steps.changed-files-specific.outputs.deleted_files }}
884897
run: |
885898
for file in "$DELETED_FILES"; do
886899
echo "$file was deleted"
@@ -992,15 +1005,13 @@ jobs:
9921005
id: changed-files-specific
9931006
uses: tj-actions/changed-files@v40
9941007
with:
995-
safe_output: false
9961008
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
9971009
files: .github/**
9981010

9991011
- name: Run step if any file(s) in the .github folder change
10001012
if: steps.changed-files-specific.outputs.any_changed == 'true'
10011013
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 }}
10041015
run: |
10051016
echo "One or more files in the .github folder has changed."
10061017
echo "List all the files that have changed: $ALL_CHANGED_FILES"
@@ -1026,7 +1037,6 @@ See [inputs](#inputs) for more information.
10261037
id: changed-files-for-dir1
10271038
uses: tj-actions/changed-files@v40
10281039
with:
1029-
safe_output: false
10301040
path: dir1
10311041

10321042
- name: List all added files in dir1

0 commit comments

Comments
 (0)