File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : size-comment
2+ on :
3+ workflow_run :
4+ workflows : [size-build]
5+ types : [completed]
6+
7+ permissions :
8+ pull-requests : write
9+ issues : write
10+ actions : read
11+
12+ jobs :
13+ comment :
14+ # Only run if the build workflow succeeded and was triggered by a pull request
15+ if : >
16+ github.event.workflow_run.conclusion == 'success' &&
17+ github.event.workflow_run.event == 'pull_request'
18+ runs-on : ubuntu-latest
19+ strategy :
20+ matrix :
21+ package : [nuxi, nuxt-cli, create-nuxt]
22+ steps :
23+ - name : 🔍 Get PR number
24+ id : pr
25+ uses : actions/github-script@v7
26+ with :
27+ script : |
28+ const pulls = await github.rest.repos.listPullRequestsAssociatedWithCommit({
29+ owner: context.repo.owner,
30+ repo: context.repo.repo,
31+ commit_sha: context.payload.workflow_run.head_sha,
32+ });
33+ if (pulls.data.length > 0) {
34+ return pulls.data[0].number;
35+ }
36+
37+ - name : ⏬ Download artifacts from workflow run
38+ uses : actions/download-artifact@v4
39+ with :
40+ github-token : ${{ secrets.GITHUB_TOKEN }}
41+ run-id : ${{ github.event.workflow_run.id }}
42+
43+ - name : 📊 Compare sizes
44+ uses : twk3/rollup-size-compare-action@v1.2.0
45+ env :
46+ PR_NUMBER : ${{ steps.pr.outputs.result }}
47+ with :
48+ title : ${{ matrix.package }} size comparison
49+ github-token : ${{ secrets.GITHUB_TOKEN }}
50+ current-stats-json-path : ./head-stats/${{ matrix.package }}/stats.json
51+ base-stats-json-path : ./base-stats/${{ matrix.package }}/stats.json
Original file line number Diff line number Diff line change 1- name : size
1+ name : size-build
22on :
3- # this action will error unless run in a pr context
4- pull_request_target :
3+ pull_request :
54branches :
65 - main
76
87env :
98BUNDLE_SIZE : true
109
11- permissions : {}
10+ permissions :
11+ contents : read
1212
1313jobs :
1414# Build current and upload stats.json
15- # You may replace this with your own build method. All that
16- # is required is that the stats.json be an artifact
1715build-head :
1816runs-on : ubuntu-latest
19- permissions :
20- contents : read
2117steps :
2218 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
23- with :
24- ref : ${{ github.event.pull_request.head.sha }}
2519 - run : corepack enable
2620 - uses : actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
2721with :
4034path : ./packages/*/stats.json
4135
4236# Build base for comparison and upload stats.json
43- # You may replace this with your own build method. All that
44- # is required is that the stats.json be an artifact
4537build-base :
4638runs-on : ubuntu-latest
47- permissions :
48- contents : read
4939steps :
5040 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
5141with :
6656with :
6757name : base-stats
6858path : ./packages/*/stats.json
69-
70- # run the action against the stats.json files
71- compare :
72- runs-on : ubuntu-latest
73- needs : [build-base, build-head]
74- permissions :
75- pull-requests : write
76- issues : write
77- strategy :
78- matrix :
79- package : [nuxi, nuxt-cli, create-nuxt]
80- steps :
81- - name : ⏬ Download stats.json
82- uses : actions/download-artifact@v5
83- - uses : twk3/rollup-size-compare-action@v1.2.0
84- with :
85- title : ${{ matrix.package }} size comparison
86- github-token : ${{ secrets.GITHUB_TOKEN }}
87- current-stats-json-path : ./head-stats/${{ matrix.package }}/stats.json
88- base-stats-json-path : ./base-stats/${{ matrix.package }}/stats.json
You can’t perform that action at this time.
0 commit comments