@@ -12,44 +12,42 @@ jobs:
1212 runs-on : ubuntu-latest
1313
1414 steps :
15+ - name : Configure git
16+ run : |
17+ git config --global user.email ""
18+ git config --global user.name "github-action[bot]"
19+
1520 - uses : marocchino/sticky-pull-request-comment@v2
1621 with :
1722 message : |
1823 ⏳ The dist files size difference is being calculated...
19-
24+
2025 - uses : actions/checkout@v4
21-
22- - uses : actions/setup-node@v4
2326 with :
24- node-version : ' 22'
25-
26- - name : Configure git
27- run : |
28- git config --global user.email ""
29- git config --global user.name "github-action[bot]"
27+ ref : ${{ github.base_ref }}
3028
31- - name : Get dist files size (from pull request )
32- id : pr -dist-files
29+ - name : Get dist files size (from base branch )
30+ id : base -dist-files
3331 run : |
3432 set -e
35-
33+
3634 FILES=$(find src -mindepth 2 -path '*/assets/dist/*' \( -name "*.js" -o -name "*.css" \) -not \( -path '*/tests/*' -o -path '*/public/*' -o -path '*/vendor/*' \) | sort | while read -r file; do
3735 echo "{\"$file\": {\"size\": $(wc -c < "$file"), \"size_gz\": $(gzip -c "$file" | wc -c), \"size_brotli\": $(brotli -c "$file" | wc -c)}}"
3836 done | jq -s 'add' -c)
39-
37+
4038 echo "files=$FILES" >> $GITHUB_OUTPUT
4139
42- - name : Get dist files size (from base branch)
43- id : base-dist-files
40+ - uses : actions/checkout@v4
41+
42+ - name : Get dist files size (from pull request)
43+ id : pr-dist-files
4444 run : |
4545 set -e
46-
47- git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
48-
46+
4947 FILES=$(find src -mindepth 2 -path '*/assets/dist/*' \( -name "*.js" -o -name "*.css" \) -not \( -path '*/tests/*' -o -path '*/public/*' -o -path '*/vendor/*' \) | sort | while read -r file; do
5048 echo "{\"$file\": {\"size\": $(wc -c < "$file"), \"size_gz\": $(gzip -c "$file" | wc -c), \"size_brotli\": $(brotli -c "$file" | wc -c)}}"
5149 done | jq -s 'add' -c)
52-
50+
5351 echo "files=$FILES" >> $GITHUB_OUTPUT
5452
5553 - name : Generate the diff
6361 script : |
6462 const { main } = await import('${{ github.workspace }}/.github/generate-dist-files-size-diff.mjs')
6563
66- return await( main() )
64+ return await main()
6765
6866 - name : Comment on the pull request (if any failure)
6967 if : ${{ failure() }}
0 commit comments