File tree 2 files changed +187
-128
lines changed
2 files changed +187
-128
lines changed Original file line number Diff line number Diff line change
1
+ name : Bundle Size Check
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ pull_request :
6
+ branches :
7
+ - main
8
+
9
+ jobs :
10
+ bundle-size :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - name : Checkout
14
+ uses : actions/checkout@v3
15
+
16
+ - name : Set up Node.js
17
+ uses : actions/setup-node@v3
18
+ with :
19
+ node-version : 16
20
+
21
+ - name : Install pnpm
22
+ run : npm install -g pnpm
23
+
24
+ - name : Install dependencies
25
+ run : pnpm install
26
+
27
+ - name : Build project
28
+ run : pnpm run build
29
+
30
+ - name : Calculate bundle size
31
+ id : bundle-size
32
+ run : |
33
+ SIZE=$(du -s dist | awk '{print $1}')
34
+ echo "Bundle size: $SIZE bytes"
35
+ echo "::set-output name=size::$SIZE"
36
+
37
+ - name : Store bundle size as artifact
38
+ uses : actions/upload-artifact@v3
39
+ with :
40
+ name : bundle-size
41
+ path : |
42
+ dist/
43
+ !dist/**/*.map
44
+
45
+ - name : Add bundle size comment
46
+ uses :
peter-evans/[email protected]
47
+ with :
48
+ token : ${{ secrets.GITHUB_TOKEN }}
49
+ issue-number : ${{ github.event.pull_request.number }}
50
+ body : |
51
+ 📦 **Bundle size:** The bundle size increased by ${{ steps.bundle-size.outputs.size }} bytes.
You can’t perform that action at this time.
0 commit comments