mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-22 11:52:00 +00:00
61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
name: Analyze Bundle (Comment)
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ['Analyze Bundle']
|
|
types:
|
|
- completed
|
|
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
comment:
|
|
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@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
|
|
with:
|
|
workflow: analyze.yml
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
name: analysis_comment.txt
|
|
path: analysis_comment.txt
|
|
|
|
- name: Download PR number
|
|
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
|
|
with:
|
|
workflow: analyze.yml
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
name: pr_number
|
|
path: pr_number
|
|
|
|
- name: Get comment body
|
|
id: get-comment-body
|
|
if: success()
|
|
run: |
|
|
echo 'body<<EOF' >> $GITHUB_OUTPUT
|
|
echo '' >> $GITHUB_OUTPUT
|
|
echo '## Size changes' >> $GITHUB_OUTPUT
|
|
echo '' >> $GITHUB_OUTPUT
|
|
echo '<details>' >> $GITHUB_OUTPUT
|
|
echo '' >> $GITHUB_OUTPUT
|
|
cat analysis_comment.txt/__bundle_analysis_comment.txt >> $GITHUB_OUTPUT
|
|
echo '' >> $GITHUB_OUTPUT
|
|
echo '</details>' >> $GITHUB_OUTPUT
|
|
echo '' >> $GITHUB_OUTPUT
|
|
echo 'EOF' >> $GITHUB_OUTPUT
|
|
pr_number=$(cat pr_number/pr_number)
|
|
echo "pr-number=$pr_number" >> $GITHUB_OUTPUT
|
|
|
|
- name: Comment
|
|
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728
|
|
with:
|
|
header: next-bundle-analysis
|
|
number: ${{ steps.get-comment-body.outputs.pr-number }}
|
|
message: ${{ steps.get-comment-body.outputs.body }}
|