size-report.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. name: size report
  2. on:
  3. workflow_run:
  4. workflows: ['size data']
  5. types:
  6. - completed
  7. permissions:
  8. contents: read
  9. pull-requests: write
  10. issues: write
  11. env:
  12. PUPPETEER_SKIP_DOWNLOAD: 'true'
  13. jobs:
  14. size-report:
  15. runs-on: ubuntu-latest
  16. if: >
  17. github.event.workflow_run.event == 'pull_request' &&
  18. github.event.workflow_run.conclusion == 'success'
  19. steps:
  20. - uses: actions/checkout@v4
  21. - name: Install pnpm
  22. uses: pnpm/action-setup@v4.0.0
  23. - name: Install Node.js
  24. uses: actions/setup-node@v4
  25. with:
  26. node-version-file: '.node-version'
  27. cache: pnpm
  28. - name: Install dependencies
  29. run: pnpm install
  30. - name: Download Size Data
  31. uses: dawidd6/action-download-artifact@v6
  32. with:
  33. name: size-data
  34. run_id: ${{ github.event.workflow_run.id }}
  35. path: temp/size
  36. - name: Read PR Number
  37. id: pr-number
  38. run: echo "number=(cat ./temp/size/number.txt)" >> $GITHUB_OUTPUT
  39. - name: Read base branch
  40. id: pr-base
  41. run: echo "base=(cat ./temp/size/base.txt)" >> $GITHUB_OUTPUT
  42. - name: Download Previous Size Data
  43. uses: dawidd6/action-download-artifact@v6
  44. with:
  45. branch: ${{ steps.pr-base.outputs.base }}
  46. workflow: size-data.yml
  47. event: push
  48. name: size-data
  49. path: temp/size-prev
  50. if_no_artifact_found: warn
  51. - name: Prepare report
  52. run: pnpm tsx scripts/size-report.ts > size-report.md
  53. - name: Read Size Report
  54. id: size-report
  55. uses: juliangruber/read-file-action@v1
  56. with:
  57. path: ./size-report.md
  58. - name: Create Comment
  59. uses: actions-cool/maintain-one-comment@v3
  60. with:
  61. token: ${{ secrets.GITHUB_TOKEN }}
  62. number: ${{ steps.pr-number.outputs.number }}
  63. body: |
  64. ${{ steps.size-report.outputs.content }}
  65. <!-- VUE_CORE_SIZE -->
  66. body-include: '<!-- VUE_CORE_SIZE -->'