Skip to content

fix: restore size.yml workflow and update size-limit config for ESM-only build#7628

Open
Copilot wants to merge 2 commits intomainfrom
copilot/restore-size-yml-workflow
Open

fix: restore size.yml workflow and update size-limit config for ESM-only build#7628
Copilot wants to merge 2 commits intomainfrom
copilot/restore-size-yml-workflow

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

PR #6425 removed browser bundles and deleted size.yml, breaking PR bundle size comments. The size-limit config in package.json was also left pointing to the now-nonexistent dist/browser.esm.js and dist/browser.umd.js.

Changelog

New

  • Restored .github/workflows/size.yml — triggers on pull_request, runs andresz1/size-limit-action@v1 with build_script: build to handle the monorepo ESM-only build before measuring. Adds explicit permissions: pull-requests: write required for posting PR comments.

Changed

  • Updated size-limit config in root package.json to target packages/react/dist/index.js instead of the deleted browser bundles:
"size-limit": [
  {
    "path": "packages/react/dist/index.js",
    "webpack": false,
    "running": false
  }
]

Removed

  • Dropped stale size-limit entries for dist/browser.esm.js and dist/browser.umd.js

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

CI/workflow-only change — no package code or public API affected.

Testing & Reviewing

Verify that after merging, new PRs receive a bundle size comparison comment from andresz1/size-limit-action. The sizes job in ci.yml (Job Summary) is unchanged.

Merge checklist

Original prompt

Problem

PR #6425 ("feat: only publish esm bundles from @primer/react") deleted the .github/workflows/size.yml workflow and removed the browser bundle outputs (dist/browser.esm.js and dist/browser.umd.js) from the rollup config. This means:

  1. No more PR comments with bundle size differences — The size.yml workflow used andresz1/size-limit-action to post size comparison comments on pull requests (e.g., Blankslate: Add button support to PrimaryAction #5687 (comment)). This was deleted in PR feat: only publish esm bundles from @primer/react #6425.

  2. Stale size-limit config — The root package.json still has a size-limit config pointing to the now-nonexistent packages/react/dist/browser.esm.js and packages/react/dist/browser.umd.js files.

The sizes job in ci.yml still runs get-export-sizes.cjs and writes to the GitHub Actions Job Summary, but it does NOT post PR comments. The PR comment behavior was exclusively handled by size.yml.

What to Fix

1. Restore .github/workflows/size.yml

Re-create the workflow file at .github/workflows/size.yml. It should:

  • Trigger on pull_request events
  • Use the andresz1/size-limit-action GitHub Action (use a recent version/SHA)
  • Pass github_token: ${{ secrets.GITHUB_TOKEN }}
  • Since the package is now ESM-only and in a monorepo, the action needs to build the project first. Add a build_script option with value build so the action runs npm run build before measuring sizes.

Example structure:

name: Size
on: [pull_request]
jobs:
  size:
    name: Size
    runs-on: ubuntu-latest
    env:
      CI_JOB_NUMBER: 1
    steps:
      - uses: actions/checkout@v4
      - uses: andresz1/size-limit-action@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          build_script: build

2. Update size-limit config in root package.json

Update the size-limit array to point to the actual ESM entrypoints that exist after the build. The old browser bundles no longer exist. The new main entrypoint is packages/react/dist/index.js. Update the config to:

"size-limit": [
  {
    "path": "packages/react/dist/index.js",
    "webpack": false,
    "running": false
  }
]

Remove the entries for browser.esm.js and browser.umd.js since those files are no longer produced by the build.

3. Optionally clean up dead dependencies

If there's nothing else using them, the size-limit and @size-limit/preset-big-lib dependencies and the "size": "size-limit" script in root package.json should be kept since they're needed by the size-limit-action.

Context

  • The get-export-sizes.cjs script at packages/react/script/get-export-sizes.cjs and the sizes job in ci.yml are separate — they write to Job Summary, not PR comments. Leave them as-is.
  • The size-limit-action is what provides the PR comment behavior.
  • The rollup config now only produces ESM output to the dist/ directory (no more lib/, lib-esm/, or dist/browser.*.js).
  • Make sure to run npm run format before committing to pass CI formatting checks.

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2026

⚠️ No Changeset found

Latest commit: bd55d40

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

…trypoint

Co-authored-by: TylerJDev <26746305+TylerJDev@users.noreply.github.com>
Copilot AI changed the title [WIP] Restore size.yml workflow for bundle size comments fix: restore size.yml workflow and update size-limit config for ESM-only build Mar 5, 2026
@TylerJDev TylerJDev self-requested a review March 5, 2026 16:39
@TylerJDev TylerJDev marked this pull request as ready for review March 5, 2026 16:39
@TylerJDev TylerJDev requested a review from a team as a code owner March 5, 2026 16:39
Copilot AI review requested due to automatic review settings March 5, 2026 16:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

size-limit report 📦

Path Size
0 B (+100% 🔺)
packages/react/dist/index.js 990 B (+100% 🔺)

@github-actions github-actions bot temporarily deployed to storybook-preview-7628 March 5, 2026 17:47 Inactive
@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@primer-integration
Copy link

👋 Hi from github/github-ui! Your integration PR is being built, you can follow the progress here: https://github.com/github/github-ui/actions/runs/22764341970

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants