size-report.yml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  22. - name: Setup Vite+
  23. uses: voidzero-dev/setup-vp@v1
  24. with:
  25. node-version-file: '.node-version'
  26. cache: true
  27. - name: Download Size Data
  28. uses: dawidd6/action-download-artifact@b6e2e70617bc3265edd6dab6c906732b2f1ae151 # v21
  29. with:
  30. name: size-data
  31. run_id: ${{ github.event.workflow_run.id }}
  32. path: temp/size
  33. - name: Read PR Number
  34. id: pr-number
  35. uses: juliangruber/read-file-action@271ff311a4947af354c6abcd696a306553b9ec18 # v1.1.8
  36. with:
  37. path: temp/size/number.txt
  38. - name: Read base branch
  39. id: pr-base
  40. uses: juliangruber/read-file-action@271ff311a4947af354c6abcd696a306553b9ec18 # v1.1.8
  41. with:
  42. path: temp/size/base.txt
  43. - name: Download Previous Size Data
  44. uses: dawidd6/action-download-artifact@b6e2e70617bc3265edd6dab6c906732b2f1ae151 # v21
  45. with:
  46. branch: ${{ steps.pr-base.outputs.content }}
  47. workflow: size-data.yml
  48. event: push
  49. name: size-data
  50. path: temp/size-prev
  51. if_no_artifact_found: warn
  52. - name: Prepare report
  53. run: node scripts/size-report.js > size-report.md
  54. - name: Read Size Report
  55. id: size-report
  56. uses: juliangruber/read-file-action@271ff311a4947af354c6abcd696a306553b9ec18 # v1.1.8
  57. with:
  58. path: ./size-report.md
  59. - name: Create Comment
  60. # The original action repository is blocked by GitHub, so use its backup pinned to a commit.
  61. uses: actions-cool/maintain-one-comment-backup@fbbc22ad1809c1bcf46f19b58397b6254773588c # backup for v3.0.0
  62. with:
  63. token: ${{ secrets.GITHUB_TOKEN }}
  64. number: ${{ steps.pr-number.outputs.content }}
  65. body: |
  66. ${{ steps.size-report.outputs.content }}
  67. <!-- VUE_CORE_SIZE -->
  68. body-include: '<!-- VUE_CORE_SIZE -->'