You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.1 KiB
71 lines
2.1 KiB
3 years ago
|
name: Analyze Bundle (Comment)
|
||
3 years ago
|
|
||
|
on:
|
||
|
workflow_run:
|
||
3 years ago
|
workflows: ["Analyze Bundle"]
|
||
3 years ago
|
types:
|
||
|
- completed
|
||
|
|
||
|
jobs:
|
||
3 years ago
|
upload:
|
||
3 years ago
|
runs-on: ubuntu-latest
|
||
|
if: >
|
||
|
${{ github.event.workflow_run.event == 'pull_request' &&
|
||
|
github.event.workflow_run.conclusion == 'success' }}
|
||
|
steps:
|
||
|
- name: Download base branch bundle stats
|
||
|
uses: dawidd6/action-download-artifact@v2
|
||
|
with:
|
||
3 years ago
|
workflow: analyze.yml
|
||
3 years ago
|
name: analysis_comment.txt
|
||
|
path: analysis_comment.txt
|
||
|
|
||
3 years ago
|
- name: Download PR number
|
||
|
uses: dawidd6/action-download-artifact@v2
|
||
|
with:
|
||
|
workflow: analyze.yml
|
||
|
name: pr_number
|
||
|
path: pr_number
|
||
|
|
||
3 years ago
|
- name: Get comment body
|
||
|
id: get-comment-body
|
||
3 years ago
|
if: success()
|
||
3 years ago
|
run: |
|
||
3 years ago
|
pr_number=$(cat pr_number)
|
||
3 years ago
|
body=$(cat analysis_comment.txt)
|
||
|
body="## Size Changes
|
||
|
<details>
|
||
|
|
||
|
${body}
|
||
|
|
||
|
</details>"
|
||
|
body="${body//'%'/'%25'}"
|
||
|
body="${body//$'\n'/'%0A'}"
|
||
|
body="${body//$'\r'/'%0D'}"
|
||
|
echo ::set-output name=body::$body
|
||
3 years ago
|
echo ::set-output name=pr-number::$pr_number
|
||
3 years ago
|
working-directory: beta
|
||
|
|
||
|
- name: Find Comment
|
||
|
uses: peter-evans/find-comment@v1
|
||
3 years ago
|
if: success()
|
||
3 years ago
|
id: fc
|
||
|
with:
|
||
3 years ago
|
issue-number: ${{ steps.get-comment-body.outputs.pr-number }}
|
||
3 years ago
|
body-includes: "<!-- __NEXTJS_BUNDLE -->"
|
||
|
|
||
|
- name: Create Comment
|
||
|
uses: peter-evans/create-or-update-comment@v1.4.4
|
||
3 years ago
|
if: success() && steps.fc.outputs.comment-id == 0
|
||
3 years ago
|
with:
|
||
3 years ago
|
issue-number: ${{ steps.get-comment-body.outputs.pr-number }}
|
||
3 years ago
|
body: ${{ steps.get-comment-body.outputs.body }}
|
||
|
|
||
|
- name: Update Comment
|
||
|
uses: peter-evans/create-or-update-comment@v1.4.4
|
||
3 years ago
|
if: success() && steps.fc.outputs.comment-id != 0
|
||
3 years ago
|
with:
|
||
3 years ago
|
issue-number: ${{ steps.get-comment-body.outputs.pr-number }}
|
||
3 years ago
|
body: ${{ steps.get-comment-body.outputs.body }}
|
||
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||
|
edit-mode: replace
|