Skip to content

Commit 467d015

Browse files
committed
Fix spacial character in job
1 parent 9a81ba2 commit 467d015

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/preview.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff 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))
@@ -54,7 +59,7 @@ jobs:
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=""

0 commit comments

Comments
 (0)