1- name : Bundle Analysis Comment
1+ name : Analyze Bundle ( Comment)
22
33on :
44 workflow_run :
5- workflows : ["Bundle Analysis Upload "]
5+ workflows : ["Analyze Bundle "]
66 types :
77 - completed
88
99jobs :
10- comment :
10+ upload :
1111 runs-on : ubuntu-latest
1212 if : >
1313 ${{ github.event.workflow_run.event == 'pull_request' &&
1414 github.event.workflow_run.conclusion == 'success' }}
1515 steps :
1616 - name : Download base branch bundle stats
1717 uses : dawidd6/action-download-artifact@v2
18- if : success() && github.event.number
1918 with :
20- workflow : bundle_analysis_upload .yml
19+ workflow : analyze .yml
2120 name : analysis_comment.txt
2221 path : analysis_comment.txt
2322
23+ - name : Download PR number
24+ uses : dawidd6/action-download-artifact@v2
25+ with :
26+ workflow : analyze.yml
27+ name : pr_number
28+ path : pr_number
29+
2430 - name : Get comment body
2531 id : get-comment-body
26- if : success() && github.event.number
32+ if : success()
2733 run : |
34+ pr_number=$(cat pr_number)
2835 body=$(cat analysis_comment.txt)
2936 body="## Size Changes
3037 <details>
@@ -36,28 +43,29 @@ jobs:
3643 body="${body//$'\n'/'%0A'}"
3744 body="${body//$'\r'/'%0D'}"
3845 echo ::set-output name=body::$body
46+ echo ::set-output name=pr-number::$pr_number
3947 working-directory : beta
4048
4149 - name : Find Comment
4250 uses : peter-evans/find-comment@v1
43- if : success() && github.event.number
51+ if : success()
4452 id : fc
4553 with :
46- issue-number : ${{ github.event. number }}
54+ issue-number : ${{ steps.get-comment-body.outputs.pr- number }}
4755 body-includes : " <!-- __NEXTJS_BUNDLE -->"
4856
4957 - name : Create Comment
5058 uses : peter-evans/create-or-update-comment@v1.4.4
51- if : success() && github.event.number && steps.fc.outputs.comment-id == 0
59+ if : success() && steps.fc.outputs.comment-id == 0
5260 with :
53- issue-number : ${{ github.event. number }}
61+ issue-number : ${{ steps.get-comment-body.outputs.pr- number }}
5462 body : ${{ steps.get-comment-body.outputs.body }}
5563
5664 - name : Update Comment
5765 uses : peter-evans/create-or-update-comment@v1.4.4
58- if : success() && github.event.number && steps.fc.outputs.comment-id != 0
66+ if : success() && steps.fc.outputs.comment-id != 0
5967 with :
60- issue-number : ${{ github.event. number }}
68+ issue-number : ${{ steps.get-comment-body.outputs.pr- number }}
6169 body : ${{ steps.get-comment-body.outputs.body }}
6270 comment-id : ${{ steps.fc.outputs.comment-id }}
6371 edit-mode : replace
0 commit comments