Skip to content

Commit c27934e

Browse files
committed
Add warning to highlight large imgs
1 parent b33460f commit c27934e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.github/workflows/preview.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ jobs:
8989
find ./content/hardware -type f -name "*-pinout.png" -exec cp {} ./static/resources/pinouts/ \;
9090
find ./content/hardware -type f -name "*-step.zip" -exec cp {} ./static/resources/models/ \;
9191
92+
- name: Check for large files
93+
run: |
94+
find content -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.svg" -o -name "*.gif" \) -size +2M -print0 |
95+
while IFS= read -r -d $'\0' file; do
96+
size=$(ls -lh "$file" | awk '{print $5}')
97+
echo "::warning file=$file::Image is very large: $size. Consider optimizing it."
98+
done
99+
100+
find content -type f \( -name "*.pdf" -o -name "*.zip" -o -name "*.mp4" \) -size +10M -print0 |
101+
while IFS= read -r -d $'\0' file; do
102+
size=$(ls -lh "$file" | awk '{print $5}')
103+
echo "::warning file=$file::Asset file is very large: $size. This can impact repository size and checkout times."
104+
done
105+
92106
- name: Gatsby main cache
93107
uses: actions/cache@v4
94108
id: gatsby-cache-folder

0 commit comments

Comments
 (0)