File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -22,23 +22,28 @@ jobs:
2222 - name : Get changed files
2323 id : changed-files
2424 uses : tj-actions/changed-files@v44
25+ with :
26+ separator : ' \n'
2527
2628 - name : Enforce Image Size Limits on Changed Files
2729 if : steps.changed-files.outputs.all_changed_files
2830 run : |
2931 #!/bin/bash
3032 set -e
3133
32- # Input from the previous step
33- CHANGED_FILES="${{ steps.changed-files.outputs.all_changed_files }}"
34-
3534 IMAGE_LIMIT_MB=2
3635 GIF_LIMIT_MB=10
3736
3837 OVERSIZED_IMAGES=""
3938 OVERSIZED_GIFS=""
4039
41- for file in $CHANGED_FILES; do
40+ while IFS= read -r file; do
41+ if [ -z "$file" ]; then continue; fi
42+ if [ ! -f "$file" ]; then
43+ echo "Warning: Changed file not found, skipping: $file"
44+ continue
45+ fi
46+
4247 if [[ "$file" == *.png || "$file" == *.jpg || "$file" == *.jpeg || "$file" == *.svg ]]; then
4348 size_in_bytes=$(stat -c%s "$file")
4449 limit_in_bytes=$((IMAGE_LIMIT_MB * 1024 * 1024))
5459 OVERSIZED_GIFS+=" - $file ($size_human)\n"
5560 fi
5661 fi
57- done
62+ done <<< "${{ steps.changed-files.outputs.all_changed_files }}"
5863
5964 # --- Report errors if any oversized files are found ---
6065 ERROR_MESSAGE=""
You can’t perform that action at this time.
0 commit comments