Repository navigation
chore: Bump serialize-javascript from 7.0.5 to 7.1.4 #19063
This file contains hidden or 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: Measure bundle size | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| # Also measure each commit on main: operational tooling consumes the recorded | |
| # bundle size per main commit to track it over time. | |
| push: | |
| branches: | |
| - main | |
| # Cancel superseded runs for the same ref to free shared runner capacity. | |
| # Only cancel PR runs; other events keep their runs. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| # The pull_request path runs untrusted PR code (npm install + build) and therefore | |
| # requests no write permissions. Fork PRs would have their token downgraded to | |
| # read-only anyway. Posting the commit status is delegated to the separate | |
| # "Report bundle size" workflow (bundle-size-report.yml), which runs with | |
| # elevated permissions but never executes PR code. | |
| permissions: | |
| contents: read | |
| jobs: | |
| measure: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| # ------- Setup ----------------------------------------------------- | |
| - name: Checkout the PR branch | |
| uses: actions/checkout@v4 | |
| with: | |
| path: 'components' | |
| - name: Setup the bundle measurement project | |
| run: | | |
| cp -r components/.github/workflows/bundle-size bundle-size | |
| cd bundle-size | |
| npm i --force | |
| # ------- Base branch size measurement ------------------------------ | |
| - name: Checkout the base branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.base.sha }} | |
| path: 'components' | |
| - name: Measure the bundle size of the base branch | |
| run: | | |
| cd components | |
| npm i --force | |
| npm run quick-build | |
| cd ../bundle-size | |
| npm run build | |
| mv output.json output-basebranch.json | |
| cat output-basebranch.json | |
| # ------- Pull request size measurement ----------------------------- | |
| - name: Checkout the PR branch | |
| uses: actions/checkout@v4 | |
| with: | |
| path: 'components' | |
| - name: Measure the bundle size of this PR | |
| id: measure | |
| run: | | |
| cd components | |
| npm i --force | |
| npm run quick-build | |
| cd ../bundle-size | |
| npm run build | |
| cat output.json | |
| # Only the numeric measurements are uploaded. The report workflow derives | |
| # the commit SHA from the trusted workflow_run event, not from this | |
| # artifact, and handles a missing/failed run via the run conclusion — so | |
| # no artifact is needed on the failure path. | |
| - name: Upload size report artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: size-report | |
| path: | | |
| bundle-size/output.json | |
| bundle-size/output-basebranch.json | |
| if-no-files-found: error | |
| # Records the absolute bundle size of each main commit as a "Bundle size" | |
| # commit status, for operational tracking of size over time. Runs only on | |
| # push (never fork code), so a statuses:write token is available and safe. | |
| measure-main: | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| statuses: write | |
| steps: | |
| - name: Checkout the pushed commit | |
| uses: actions/checkout@v4 | |
| with: | |
| path: 'components' | |
| - name: Setup the bundle measurement project | |
| run: | | |
| cp -r components/.github/workflows/bundle-size bundle-size | |
| cd bundle-size | |
| npm i --force | |
| - name: Measure the bundle size of this commit | |
| run: | | |
| cd components | |
| npm i --force | |
| npm run quick-build | |
| cd ../bundle-size | |
| npm run build | |
| cat output.json | |
| - name: Upload size report artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: size-report | |
| path: bundle-size/output.json | |
| if-no-files-found: error | |
| - name: Post the commit status with the absolute size | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { reportMainBundleSize } = await import( | |
| process.cwd() + '/components/.github/workflows/bundle-size/status-report.js' | |
| ); | |
| await reportMainBundleSize({ | |
| github, | |
| context, | |
| sha: context.sha, | |
| dataDir: process.cwd() + '/bundle-size', | |
| targetUrl: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | |
| }); |