一键导入
changesets
// Use when: adding changesets to pull requests, determining semver bump types, versioning packages, or preparing releases. Covers changeset file format, semver guidance, when changesets are required, and the release pipeline.
// Use when: adding changesets to pull requests, determining semver bump types, versioning packages, or preparing releases. Covers changeset file format, semver guidance, when changesets are required, and the release pipeline.
| name | changesets |
| description | Use when: adding changesets to pull requests, determining semver bump types, versioning packages, or preparing releases. Covers changeset file format, semver guidance, when changesets are required, and the release pipeline. |
This repository uses Changesets to manage versioning and changelogs. Every pull request that changes the public API or runtime behavior of a package must include a changeset file.
A changeset is a markdown file in the .changeset/ directory that describes:
@primer/react)patch, minor, or major)Changeset files live in .changeset/ and have a random name with a .md extension. The file uses YAML frontmatter to specify the package and bump type, followed by a description:
---
'@primer/react': patch
---
ActionMenu: Fix focus management when menu is closed with Escape key
The description becomes a single line item in the public changelog and release notes, so keep it terse. Follow this pattern:
Aim for a description a consumer can scan in a few seconds.
Good — terse and consumer-facing:
UnderlinePanels: Improve rendering performance when toggling tab icons
Avoid — verbose, implementation-focused, multi-clause:
UnderlinePanels: Eliminate the empty-tablist frame on mount and the cascading
re-render when icons toggle. Tabs and panels are now derived in render
(previously stored in state synced via `useEffect`), the list width is kept in a
ref instead of state, and `iconsVisible` / `loadingCounters` flow to each tab
via context — combined with `React.memo(Tab)`...
The "Avoid" example reads like a commit message or PR body. Save that level of detail for the pull request description; the changeset should summarize the consumer-facing effect only.
Run npx changeset and follow the prompts to select the package, bump type, and enter a description.
Create a new file in .changeset/ with a unique name (e.g., .changeset/my-change-description.md):
---
'@primer/react': minor
---
Avatar: Add `square` variant for non-user avatars
Use lowercase kebab-case for the filename. The name is arbitrary but should be descriptive.
Use this quick reference to determine the bump type. For the full decision table with detailed examples, see contributor-docs/versioning.md.
patch — Bug fixes and internal correctionsminor — New features and non-breaking additionsstring → string | number)data-component attributemajor — Breaking changesstring → 'a' | 'b')data-component attributeSkip the changeset for changes that do not affect the published package:
examples/ or e2e/ directoriesWhen a changeset is not needed, add the skip changeset label to the pull request. This bypasses the CI check that requires a changeset to be present.
If a PR introduces multiple distinct changes, add a separate changeset file for each. For example, if you fix a bug in Button and add a new prop to ActionMenu, create two changeset files — one patch for the fix and one minor for the new prop.
Understanding the release pipeline helps explain why changesets are required:
changeset-bot comments on the PR indicating whether valid changesets are present. If your change requires a changeset and none is found, the bot will flag it.main: The changesets/action GitHub Action automatically creates or updates a "Version Packages" release PR that bumps version numbers, updates CHANGELOG.md, and shows release notes..changeset/*.md — Changeset files (one per change).changeset/config.json — Changesets configurationcontributor-docs/versioning.md — Detailed semver bump guidancecontributor-docs/CONTRIBUTING.md — Contributing guidelines including changeset instructionsUse when: building, modifying, or wrapping compound components that use child-component "slots" in Primer React. Covers when to add a `__SLOT__` marker, the `useSlots` hook, the `isSlot` helper, the `asSlot` wrapper helper, naming conventions for slot symbols, and common pitfalls.
Use when: deprecating Primer React components or hooks. Covers source annotations, docs metadata, changesets, docs page updates, and validation for deprecations.
Use when: implementing, creating, testing, or debugging feature flags in Primer React. Covers useFeatureFlag hook, FeatureFlags provider, DefaultFeatureFlags, FeatureFlagScope, Storybook integration, and the feature flag lifecycle at GitHub.
Use when: starting, checking, or using the Storybook dev server; looking up Primer React component stories, props, or documentation; previewing component variants; writing or verifying Storybook stories; using the primer-storybook MCP to explore components. Covers starting Storybook, checking if it is running, and using MCP tools (list-all-documentation, get-documentation, get-storybook-story-instructions, preview-stories) to look up components.