|
| 1 | +name: size report |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ['size data'] |
| 6 | + types: |
| 7 | + - completed |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + pull-requests: write |
| 12 | + issues: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + size-report: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + if: > |
| 18 | + github.repository == 'intlify/vue-i18n' && |
| 19 | + github.event.workflow_run.event == 'pull_request' && |
| 20 | + github.event.workflow_run.conclusion == 'success' |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Install pnpm |
| 25 | + |
| 26 | + |
| 27 | + - name: Install Node.js |
| 28 | + uses: actions/setup-node@v4 |
| 29 | + with: |
| 30 | + node-version: 23 |
| 31 | + cache: pnpm |
| 32 | + |
| 33 | + - name: Install dependencies |
| 34 | + run: pnpm install --frozen-lockfile |
| 35 | + |
| 36 | + - name: Download Size Data |
| 37 | + uses: dawidd6/action-download-artifact@v6 |
| 38 | + with: |
| 39 | + name: size-data |
| 40 | + run_id: ${{ github.event.workflow_run.id }} |
| 41 | + path: temp/size |
| 42 | + |
| 43 | + - name: Read PR Number |
| 44 | + id: pr-number |
| 45 | + uses: juliangruber/read-file-action@v1 |
| 46 | + with: |
| 47 | + path: temp/size/number.txt |
| 48 | + |
| 49 | + - name: Read base branch |
| 50 | + id: pr-base |
| 51 | + uses: juliangruber/read-file-action@v1 |
| 52 | + with: |
| 53 | + path: temp/size/base.txt |
| 54 | + |
| 55 | + - name: Download Previous Size Data |
| 56 | + uses: dawidd6/action-download-artifact@v6 |
| 57 | + with: |
| 58 | + branch: ${{ steps.pr-base.outputs.content }} |
| 59 | + workflow: size-data.yml |
| 60 | + event: push |
| 61 | + name: size-data |
| 62 | + path: temp/size-prev |
| 63 | + if_no_artifact_found: warn |
| 64 | + |
| 65 | + - name: Prepare report |
| 66 | + run: npx tsx scripts/size-report.ts > size-report.md |
| 67 | + |
| 68 | + - name: Read Size Report |
| 69 | + id: size-report |
| 70 | + uses: juliangruber/read-file-action@v1 |
| 71 | + with: |
| 72 | + path: ./size-report.md |
| 73 | + |
| 74 | + - name: Create Comment |
| 75 | + uses: actions-cool/maintain-one-comment@v3 |
| 76 | + with: |
| 77 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + number: ${{ steps.pr-number.outputs.content }} |
| 79 | + body: | |
| 80 | + ${{ steps.size-report.outputs.content }} |
| 81 | + <!-- INTLIFY_VUE_I18N_SIZE --> |
| 82 | + body-include: '<!-- INTLIFY_VUE_I18N_SIZE -->' |
0 commit comments