11name : size report
22
33on :
4- pull_request :
5- branches :
6- - main
4+ workflow_run :
5+ workflows : ['size data']
6+ types :
7+ - completed
78
89permissions :
910 contents : read
1011 pull-requests : write
12+ issues : write
1113
1214jobs :
13- size :
15+ size-report :
1416 runs-on : ubuntu-latest
15-
17+ if : >
18+ github.event.workflow_run.event == 'pull_request' &&
19+ github.event.workflow_run.conclusion == 'success'
1620 steps :
1721 - uses : actions/checkout@v3
1822
@@ -25,37 +29,52 @@ jobs:
2529 node-version : lts/*
2630 cache : pnpm
2731
28- - run : PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
29- - run : pnpm run size
32+ - name : Install dependencies
33+ run : PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
3034
31- - name : Download Previous Size Report
32- id : download-artifact
35+ - name : Download PR number
3336 uses : dawidd6/action-download-artifact@v2
3437 with :
35- branch : main
36- name : size-report
37- path : temp/size-prev
38- if_no_artifact_found : warn
38+ name : pr-number
39+ run_id : ${{ github.event.workflow_run.id }}
40+
41+ - name : Read PR Number
42+ id : pr-number
43+ uses : juliangruber/read-file-action@v1
44+ with :
45+ path : ./pr.txt
3946
40- - name : Upload Size Report
41- uses : actions/upload- artifact@v3
47+ - name : Download Size Data
48+ uses : dawidd6/action-download- artifact@v2
4249 with :
43- name : size-report
50+ name : size-data
51+ run_id : ${{ github.event.workflow_run.id }}
4452 path : temp/size
4553
54+ - name : Download Previous Size Data
55+ uses : dawidd6/action-download-artifact@v2
56+ with :
57+ branch : main
58+ workflow : size-data.yml
59+ name : size-data
60+ path : temp/size-prev
61+ if_no_artifact_found : warn
62+
4663 - name : Compare size
47- run : pnpm tsx scripts/size-report.ts > size.md
64+ run : pnpm tsx scripts/size-report.ts > size-report .md
4865
49- - name : Read Size Markdown
50- id : size-markdown
66+ - name : Read Size Report
67+ id : size-report
5168 uses : juliangruber/read-file-action@v1
5269 with :
53- path : ./size.md
70+ path : ./size-report .md
5471
5572 - name : Create Comment
5673 uses : actions-cool/maintain-one-comment@v3
5774 with :
75+ token : ${{ secrets.GITHUB_TOKEN }}
76+ number : ${{ steps.pr-number.outputs.content }}
5877 body : |
59- ${{steps.size-markdown .outputs.content}}
78+ ${{ steps.size-report .outputs.content }}
6079 <!-- VUE_CORE_SIZE -->
6180 body-include : ' <!-- VUE_CORE_SIZE -->'
0 commit comments