Allow editing of asset number #4217
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: Bundle size diff | |
on: | |
pull_request: | |
paths: | |
- "client/**" | |
jobs: | |
build-base: | |
name: Build base | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Read .nvmrc | |
run: echo "##[set-output name=NVMRC;]$(cat ./client/.nvmrc)" | |
id: nvm | |
- name: Use Node.js (.nvmrc) | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "${{ steps.nvm.outputs.NVMRC }}" | |
- name: Install dependencies | |
run: cd ./client && rm -rf node_modules && yarn install --frozen-lockfile | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.TOKEN_REPO}} | |
- name: Build | |
run: cd ./client && yarn build-stats | |
- name: Upload base stats.json | |
uses: actions/upload-artifact@v4 | |
with: | |
name: base | |
path: ./client/packages/host/dist/stats.json | |
retention-days: 3 | |
build-pr: | |
name: Build PR | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Read .nvmrc | |
run: echo "##[set-output name=NVMRC;]$(cat ./client/.nvmrc)" | |
id: nvm | |
- name: Use Node.js (.nvmrc) | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "${{ steps.nvm.outputs.NVMRC }}" | |
- name: Install dependencies | |
run: cd ./client && rm -rf node_modules && yarn install --frozen-lockfile | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.TOKEN_REPO}} | |
- name: Build | |
run: cd ./client && yarn build-stats | |
- name: Upload base stats.json | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr | |
path: ./client/packages/host/dist/stats.json | |
retention-days: 3 | |
report: | |
name: Generate report | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: [build-base, build-pr] | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@v4 | |
- name: Download base stats | |
uses: actions/download-artifact@v4 | |
with: | |
name: base | |
path: base | |
- name: Download PR stats | |
uses: actions/download-artifact@v4 | |
with: | |
name: pr | |
path: pr | |
- name: Get diff | |
id: get-diff | |
uses: NejcZdovc/bundle-size-diff@v1 | |
with: | |
base_path: "./base/stats.json" | |
pr_path: "./pr/stats.json" | |
- name: Comment | |
uses: NejcZdovc/comment-pr@v1 | |
with: | |
file: "comment.md" | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
OLD: ${{steps.get-diff.outputs.base_file_string}} | |
NEW: ${{steps.get-diff.outputs.pr_file_string}} | |
DIFF: ${{steps.get-diff.outputs.diff_file_string}} | |
DIFF_PERCENT: ${{steps.get-diff.outputs.percent}} |