size-report.yml 2.3 KB

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