1
1
name : size report
2
2
3
3
on :
4
- pull_request :
5
- branches :
6
- - main
4
+ workflow_run :
5
+ workflows : ['size data']
6
+ types :
7
+ - completed
7
8
8
9
permissions :
9
10
contents : read
10
11
pull-requests : write
12
+ issues : write
11
13
12
14
jobs :
13
- size :
15
+ size-report :
14
16
runs-on : ubuntu-latest
15
-
17
+ if : >
18
+ github.event.workflow_run.event == 'pull_request' &&
19
+ github.event.workflow_run.conclusion == 'success'
16
20
steps :
17
21
- uses : actions/checkout@v3
18
22
@@ -25,37 +29,52 @@ jobs:
25
29
node-version : lts/*
26
30
cache : pnpm
27
31
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
30
34
31
- - name : Download Previous Size Report
32
- id : download-artifact
35
+ - name : Download PR number
33
36
uses : dawidd6/action-download-artifact@v2
34
37
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
39
46
40
- - name : Upload Size Report
41
- uses : actions/upload- artifact@v3
47
+ - name : Download Size Data
48
+ uses : dawidd6/action-download- artifact@v2
42
49
with :
43
- name : size-report
50
+ name : size-data
51
+ run_id : ${{ github.event.workflow_run.id }}
44
52
path : temp/size
45
53
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
+
46
63
- name : Compare size
47
- run : pnpm tsx scripts/size-report.ts > size.md
64
+ run : pnpm tsx scripts/size-report.ts > size-report .md
48
65
49
- - name : Read Size Markdown
50
- id : size-markdown
66
+ - name : Read Size Report
67
+ id : size-report
51
68
uses : juliangruber/read-file-action@v1
52
69
with :
53
- path : ./size.md
70
+ path : ./size-report .md
54
71
55
72
- name : Create Comment
56
73
uses : actions-cool/maintain-one-comment@v3
57
74
with :
75
+ token : ${{ secrets.GITHUB_TOKEN }}
76
+ number : ${{ steps.pr-number.outputs.content }}
58
77
body : |
59
- ${{steps.size-markdown .outputs.content}}
78
+ ${{ steps.size-report .outputs.content }}
60
79
<!-- VUE_CORE_SIZE -->
61
80
body-include : ' <!-- VUE_CORE_SIZE -->'
0 commit comments