Skip to content

Commit 38b92c8

Browse files
committed
Add files path on large files check
1 parent 5b445db commit 38b92c8

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

.github/workflows/deploy-production.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ jobs:
7676
find content -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.svg" -o -name "*.gif" \) -size +2M -print0 |
7777
while IFS= read -r -d $'\0' file; do
7878
size=$(ls -lh "$file" | awk '{print $5}')
79-
echo "::warning file=$file::Image is very large: $size. Consider optimizing it."
79+
echo "::warning file=$file::File '$file' is very large: $size. Consider optimizing it."
8080
done
8181
8282
find content -type f \( -name "*.pdf" -o -name "*.zip" -o -name "*.mp4" \) -size +10M -print0 |
8383
while IFS= read -r -d $'\0' file; do
8484
size=$(ls -lh "$file" | awk '{print $5}')
85-
echo "::warning file=$file::Asset file is very large: $size. This can impact repository size and checkout times."
85+
echo "::warning file=$file::File '$file' is very large: $size. This can impact repository size and checkout times."
8686
done
8787
8888
- name: Gatsby main cache

.github/workflows/deploy-staging.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ jobs:
7171
find ./content/hardware -type f -name "*-pinout.png" -exec cp {} ./static/resources/pinouts/ \;
7272
find ./content/hardware -type f -name "*-step.zip" -exec cp {} ./static/resources/models/ \;
7373
74+
- name: Check for large files
75+
run: |
76+
find content -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.svg" -o -name "*.gif" \) -size +2M -print0 |
77+
while IFS= read -r -d $'\0' file; do
78+
size=$(ls -lh "$file" | awk '{print $5}')
79+
echo "::warning file=$file::File '$file' is very large: $size. Consider optimizing it."
80+
done
81+
82+
find content -type f \( -name "*.pdf" -o -name "*.zip" -o -name "*.mp4" \) -size +10M -print0 |
83+
while IFS= read -r -d $'\0' file; do
84+
size=$(ls -lh "$file" | awk '{print $5}')
85+
echo "::warning file=$file::File '$file' is very large: $size. This can impact repository size and checkout times."
86+
done
87+
7488
- name: Gatsby main cache
7589
uses: actions/cache@v4
7690
id: gatsby-cache-folder
@@ -91,7 +105,12 @@ jobs:
91105
92106
- run: npm install
93107

94-
- run: npm run build
108+
- name: Patch Gatsby Config
109+
run: |
110+
sed -i.bak "/path: \`${__dirname}\/content\`,\s*$/a \ \ \ \ \ \ \ \ ignore: [\`**/*.zip\`, \`**/*.mp4\`, \`**/*.pdf\`, \`**/*.gif\`]," gatsby-config.js
111+
112+
- name: Build
113+
run: npm run build
95114

96115
- name: Clean up node_modules # Just to save space
97116
run: rm -rf node_modules

.github/workflows/preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ jobs:
9494
find content -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.svg" -o -name "*.gif" \) -size +2M -print0 |
9595
while IFS= read -r -d $'\0' file; do
9696
size=$(ls -lh "$file" | awk '{print $5}')
97-
echo "::warning file=$file::Image is very large: $size. Consider optimizing it."
97+
echo "::warning file=$file::File '$file' is very large: $size. Consider optimizing it."
9898
done
9999
100100
find content -type f \( -name "*.pdf" -o -name "*.zip" -o -name "*.mp4" \) -size +10M -print0 |
101101
while IFS= read -r -d $'\0' file; do
102102
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."
103+
echo "::warning file=$file::File '$file' is very large: $size. This can impact repository size and checkout times."
104104
done
105105
106106
- name: Gatsby main cache

0 commit comments

Comments
 (0)