File tree Expand file tree Collapse file tree 2 files changed +7
-41
lines changed
Expand file tree Collapse file tree 2 files changed +7
-41
lines changed Original file line number Diff line number Diff line change 77 - main # change this if your default branch is named differently
88 workflow_dispatch :
99
10- permissions : {}
10+ permissions : {}
1111
1212jobs :
13- event_type :
14- runs-on : ubuntu-latest
15- steps :
16- - uses : actions/checkout@v3
17-
18- - name : Save Event Type
19- run : echo ${{ github.event_name }} > ./event_type
20-
21- - name : Upload Event Type
22- uses : actions/upload-artifact@v4
23- with :
24- path : ./event_type
25- name : event_type
26-
2713 analyze :
2814 runs-on : ubuntu-latest
2915 steps :
7561 if : success() && github.event.number
7662 with :
7763 workflow : analyze.yml
78- branch : ${{ github.event.pull_request.base.ref || 'main' }}
64+ branch : ${{ github.event.pull_request.base.ref }}
7965 name : bundle_analysis.json
8066 path : .next/analyze/base/bundle
8167
9379 # Either of these arguments can be changed or removed by editing the `nextBundleAnalysis`
9480 # entry in your package.json file.
9581 - name : Compare with base branch bundle
96- if : success()
82+ if : success() && github.event.number
9783 run : ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
9884
9985 - name : Upload analysis comment
@@ -102,13 +88,6 @@ jobs:
10288 name : analysis_comment.txt
10389 path : .next/analyze/__bundle_analysis_comment.txt
10490
105- number :
106- runs-on : ubuntu-latest
107- needs : analyze
108- if : github.event_name == 'pull_request'
109- steps :
110- - uses : actions/checkout@v3
111-
11291 - name : Save PR number
11392 run : echo ${{ github.event.number }} > ./pr_number
11493
Original file line number Diff line number Diff line change @@ -14,23 +14,11 @@ permissions:
1414jobs :
1515 comment :
1616 runs-on : ubuntu-latest
17+ if : >
18+ ${{ github.event.workflow_run.event == 'pull_request' &&
19+ github.event.workflow_run.conclusion == 'success' }}
1720 steps :
18- - name : Download Event Type
19- uses : dawidd6/action-download-artifact@v3
20- with :
21- workflow : analyze.yml
22- run_id : ${{ github.event.workflow_run.id }}
23- name : event_type
24- path : event_type
25-
26- - name : get type
27- id : get-type
28- run : |
29- event_type=$(cat event_type/event_type)
30- echo "event-type=$event_type" >> $GITHUB_OUTPUT
31-
3221 - name : Download base branch bundle stats
33- if : github.event.workflow_run.conclusion == 'success' && steps.get-type.outputs.event-type == 'pull_request'
3422 uses : dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
3523 with :
3624 workflow : analyze.yml
3927 path : analysis_comment.txt
4028
4129 - name : Download PR number
42- if : github.event.workflow_run.conclusion == 'success' && steps.get-type.outputs.event-type == 'pull_request'
4330 uses : dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
4431 with :
4532 workflow : analyze.yml
4936
5037 - name : Get comment body
5138 id : get-comment-body
52- if : success() && github.event.workflow_run.conclusion == 'success' && steps.get-type.outputs.event-type == 'pull_request'
39+ if : success()
5340 run : |
5441 echo 'body<<EOF' >> $GITHUB_OUTPUT
5542 echo '' >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments