size-report.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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@v3.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 PR number
  31. uses: dawidd6/action-download-artifact@v3
  32. with:
  33. name: pr-number
  34. run_id: ${{ github.event.workflow_run.id }}
  35. path: /tmp/pr-number
  36. - name: Read PR Number
  37. id: pr-number
  38. uses: juliangruber/read-file-action@v1
  39. with:
  40. path: /tmp/pr-number/pr.txt
  41. - name: Download Size Data
  42. uses: dawidd6/action-download-artifact@v3
  43. with:
  44. name: size-data
  45. run_id: ${{ github.event.workflow_run.id }}
  46. path: temp/size
  47. - name: Download Previous Size Data
  48. uses: dawidd6/action-download-artifact@v3
  49. with:
  50. branch: main
  51. workflow: size-data.yml
  52. event: push
  53. name: size-data
  54. path: temp/size-prev
  55. if_no_artifact_found: warn
  56. - name: Compare size
  57. run: pnpm tsx scripts/size-report.ts > size-report.md
  58. - name: Read Size Report
  59. id: size-report
  60. uses: juliangruber/read-file-action@v1
  61. with:
  62. path: ./size-report.md
  63. - name: Create Comment
  64. uses: actions-cool/maintain-one-comment@v3
  65. with:
  66. token: ${{ secrets.GITHUB_TOKEN }}
  67. number: ${{ steps.pr-number.outputs.content }}
  68. body: |
  69. ${{ steps.size-report.outputs.content }}
  70. <!-- VUE_CORE_SIZE -->
  71. body-include: '<!-- VUE_CORE_SIZE -->'