size-report.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
  22. - name: Install pnpm
  23. uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
  24. - name: Install Node.js
  25. uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
  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@b6e2e70617bc3265edd6dab6c906732b2f1ae151 # v21
  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@271ff311a4947af354c6abcd696a306553b9ec18 # v1.1.8
  40. with:
  41. path: temp/size/number.txt
  42. - name: Read base branch
  43. id: pr-base
  44. uses: juliangruber/read-file-action@271ff311a4947af354c6abcd696a306553b9ec18 # v1.1.8
  45. with:
  46. path: temp/size/base.txt
  47. - name: Download Previous Size Data
  48. uses: dawidd6/action-download-artifact@b6e2e70617bc3265edd6dab6c906732b2f1ae151 # v21
  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@271ff311a4947af354c6abcd696a306553b9ec18 # v1.1.8
  61. with:
  62. path: ./size-report.md
  63. - name: Create Comment
  64. # The original action repository is blocked by GitHub, so use its backup pinned to a commit.
  65. uses: actions-cool/maintain-one-comment-backup@fbbc22ad1809c1bcf46f19b58397b6254773588c # backup for v3.0.0
  66. with:
  67. token: ${{ secrets.GITHUB_TOKEN }}
  68. number: ${{ steps.pr-number.outputs.content }}
  69. body: |
  70. ${{ steps.size-report.outputs.content }}
  71. <!-- VUE_CORE_SIZE -->
  72. body-include: '<!-- VUE_CORE_SIZE -->'