ci: add draft #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Report bundle size in PR | |
on: | |
- pull_request | |
jobs: | |
bundle-size-comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Install pnpm and dependencies | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: true | |
- name: Generate types | |
run: pnpm exec nuxi prepare | |
- name: Run nuxi analyze | |
run: pnpm exec nuxi analyze --no-serve | |
- name: Get size value | |
id: get-size | |
run: | | |
CLIENT_BUNDLE=$(jq .size.clientBundle .nuxt/analyze/meta.json) | |
NITRO_BUNDLE=$(jq .size.nitroBundle .nuxt/analyze/meta.json) | |
echo "{clientBundle}={$CLIENT_BUNDLE}" >> $GITHUB_OUTPUT | |
echo "{nitroBundle}={$NITRO_BUNDLE}" >> $GITHUB_OUTPUT | |
echo $CLIENT_BUNDLE | |
echo $NITRO_BUNDLE | |
echo "The client bundle size is ${{ steps.get-size.outputs.clientBundle }} and the nitro bundle size is ${{ steps.get-size.outputs.nitroBundle }}" | |
shell: bash | |
- name: Print size | |
run: echo "The client bundle size is ${{ steps.get-size.outputs.clientBundle }} and the nitro bundle size is ${{ steps.get-size.outputs.nitroBundle }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |