8
8
workflow_dispatch :
9
9
10
10
jobs :
11
+ event_type :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - uses : actions/checkout@v2
15
+
16
+ - name : Save Event Type
17
+ run : echo ${{ github.event_name }} > ./event_type
18
+
19
+ - name : Upload Event Type
20
+ uses : actions/upload-artifact@v2
21
+ with :
22
+ path : ./event_type
23
+ name : event_type
24
+
11
25
analyze :
12
26
runs-on : ubuntu-latest
13
27
steps :
@@ -48,10 +62,10 @@ jobs:
48
62
49
63
- name : Download base branch bundle stats
50
64
uses : dawidd6/action-download-artifact@v2
51
- if : success() && github.event.number
65
+ if : success()
52
66
with :
53
67
workflow : analyze.yml
54
- branch : ${{ github.event.pull_request.base.ref }}
68
+ branch : ${{ github.event.pull_request.base.ref || 'main' }}
55
69
name : bundle_analysis.json
56
70
path : .next/analyze/base/bundle
57
71
@@ -69,14 +83,21 @@ jobs:
69
83
# Either of these arguments can be changed or removed by editing the `nextBundleAnalysis`
70
84
# entry in your package.json file.
71
85
- name : Compare with base branch bundle
72
- if : success() && github.event.number
86
+ if : success()
73
87
run : ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
74
88
75
89
- name : Upload analysis comment
76
90
uses : actions/upload-artifact@v2
77
91
with :
78
92
name : analysis_comment.txt
79
93
path : .next/analyze/__bundle_analysis_comment.txt
94
+
95
+ number :
96
+ runs-on : ubuntu-latest
97
+ needs : analyze
98
+ if : github.event_name == 'pull_request'
99
+ steps :
100
+ - uses : actions/checkout@v2
80
101
81
102
- name : Save PR number
82
103
run : echo ${{ github.event.number }} > ./pr_number
0 commit comments