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.repository == 'vuejs/core' &&
  18. github.event.workflow_run.event == 'pull_request' &&
  19. github.event.workflow_run.conclusion == 'success'
  20. steps:
  21. - uses: actions/checkout@v6
  22. - name: Install pnpm
  23. uses: pnpm/action-setup@v4.2.0
  24. - name: Install Node.js
  25. uses: actions/setup-node@v6
  26. with:
  27. node-version-file: '.node-version'
  28. cache: pnpm
  29. - name: Install dependencies
  30. run: pnpm install
  31. - name: Download Size Data
  32. uses: dawidd6/action-download-artifact@v14
  33. with:
  34. name: size-data
  35. run_id: ${{ github.event.workflow_run.id }}
  36. path: temp/size
  37. - name: Read PR Number
  38. id: pr-number
  39. uses: juliangruber/read-file-action@v1
  40. with:
  41. path: temp/size/number.txt
  42. - name: Read base branch
  43. id: pr-base
  44. uses: juliangruber/read-file-action@v1
  45. with:
  46. path: temp/size/base.txt
  47. - name: Download Previous Size Data
  48. uses: dawidd6/action-download-artifact@v14
  49. with:
  50. branch: ${{ steps.pr-base.outputs.content }}
  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: Prepare report
  57. run: node scripts/size-report.js > 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 -->'