@@ -12,40 +12,37 @@ jobs:
1212 runs-on : ubuntu-latest
1313
1414 steps :
15- - uses : marocchino/sticky-pull-request-comment@v2
16- with :
17- message : |
18- ⏳ The dist files size difference is being calculated...
19-
20- - uses : actions/checkout@v4
21-
22- - uses : actions/setup-node@v4
23- with :
24- node-version : ' 22'
25-
2615 - name : Configure git
2716 run : |
2817 git config --global user.email ""
2918 git config --global user.name "github-action[bot]"
19+
20+ - uses : marocchino/sticky-pull-request-comment@v2
21+ with :
22+ message : |
23+ ⏳ The dist files size difference is being calculated...
3024
31- - name : Get dist files size (from pull request )
32- id : pr -dist-files
25+ - name : Get dist files size (from base branch )
26+ id : base -dist-files
3327 run : |
3428 set -e
35-
29+
30+ git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
31+ git checkout ${{ github.base_ref }}
32+
3633 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
3734 echo "{\"$file\": {\"size\": $(wc -c < "$file"), \"size_gz\": $(gzip -c "$file" | wc -c), \"size_brotli\": $(brotli -c "$file" | wc -c)}}"
3835 done | jq -s 'add' -c)
39-
36+
4037 echo "files=$FILES" >> $GITHUB_OUTPUT
38+
39+ - uses : actions/checkout@v4
4140
42- - name : Get dist files size (from base branch )
43- id : base -dist-files
41+ - name : Get dist files size (from pull request )
42+ id : pr -dist-files
4443 run : |
4544 set -e
4645
47- git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
48-
4946 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
5047 echo "{\"$file\": {\"size\": $(wc -c < "$file"), \"size_gz\": $(gzip -c "$file" | wc -c), \"size_brotli\": $(brotli -c "$file" | wc -c)}}"
5148 done | jq -s 'add' -c)
6360 script : |
6461 const { main } = await import('${{ github.workspace }}/.github/generate-dist-files-size-diff.mjs')
6562
66- return await( main() )
63+ return await main()
6764
6865 - name : Comment on the pull request (if any failure)
6966 if : ${{ failure() }}
0 commit comments