2
0

size-report.yml 2.1 KB

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