Skip to content

feat: add gitTagFormat config option - #2358

Open
leochiu-a wants to merge 4 commits into
changesets:mainfrom
leochiu-a:feat/tag-format
Open

leochiu-a wants to merge 4 commits into
changesets:mainfrom
leochiu-a:feat/tag-format

Conversation

@leochiu-a

@leochiu-a leochiu-a commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #772

Summary

Adds a gitTagFormat config option that sets the names of the git tags created by changeset publish and changeset git-tag:

{
  "gitTagFormat": "{name}/v{version}"
}
  • Supports the {name} and {version} variable patterns, in the same style as snapshot.prereleaseTemplate.
  • When the option isn't set, nothing changes: tags are still {name}@{version} in monorepos and v{version} in single-package repositories.

Motivation

Some tools can't use the {name}@{version} tag format:

#1210 and #1412 proposed the same option before buildGitTag() existed. Now that tag naming is centralized in buildGitTag(), the change is small.

Changes

  • @changesets/types: added gitTagFormat?: string to Config and WrittenConfig.
  • @changesets/config:
    • Added the option to the schema. It must contain {version}.
    • Added a rule that requires {name} in monorepos. Without it, packages released at the same version would get the same tag.
    • Regenerated schema.json.
  • @changesets/cli:
    • buildGitTag() uses the format when it's set.
    • The format is passed to splitByTagStatus(), so the "already tagged" check uses the same names. Tagging stays idempotent for both publish and git-tag.
    • The tag list printed after tagging shows the formatted names.
  • Docs: updated site/guide/config.md and docs/config-file-options.md.

Notes for reviewers

  • Changing the format on an existing repo: packages without a tag in the new format count as untagged, so git-tag creates tags for their current versions. The docs mention this.
  • Tools outside this repo: anything that assumes {name}@{version} (for example the GitHub releases created by changesets/action) isn't changed here. Users who set the option would need to handle that on their side.

Tests

  • Config: a valid format; a non-string value; a format without {version}; a format without {name} in a monorepo (error) and in a single-package repo (allowed).
  • git-tag command: a custom format with a scoped name; skipping packages that already have a tag in the custom format; dropping the v prefix in a single-package repo.
  • buildGitTag(): default formats; repeated variable patterns; $ patterns in a package name aren't interpreted; a package name containing {version} isn't substituted again.
  • Publish plan: private packages that already have a tag in the custom format are skipped.
  • pnpm types:check, pnpm lint, pnpm format, and pnpm test run (829 passed) all pass.

Allows customizing the names of git tags created by `changeset publish`
and `changeset git-tag` with the `{name}` and `{version}` variable
patterns. The same format is used when checking which packages are
already tagged, so tagging stays idempotent.

Closes changesets#772

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d301eee

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@changesets/cli Minor
@changesets/config Minor
@changesets/types Minor
@changesets/apply-release-plan Patch
@changesets/assemble-release-plan Patch
@changesets/get-release-plan Patch
@changesets/changelog-git Patch
@changesets/changelog-github Patch
@changesets/get-dependents-graph Patch
@changesets/git Patch
@changesets/parse Patch
@changesets/pre Patch
@changesets/read Patch
@changesets/release-utils Patch
@changesets/should-skip-package Patch
@changesets/write Patch

Not sure what this means? Click here to learn what changesets are.

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

@netlify

netlify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

👷 Deploy request for changesets pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit d301eee

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.75%. Comparing base (704f329) to head (d301eee).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2358      +/-   ##
==========================================
+ Coverage   87.71%   87.75%   +0.03%     
==========================================
  Files          81       81              
  Lines        2987     2996       +9     
  Branches      853      856       +3     
==========================================
+ Hits         2620     2629       +9     
  Misses        331      331              
  Partials       36       36              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

leochiu-a and others added 3 commits October 30, 2026 18:08
`replaceAll` with a string replacement interprets `$` patterns in the
package name, and replacing `{name}` before `{version}` substituted
`{version}` again when it appeared in the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	docs/config-file-options.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Andarist Andarist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For us to consider this, it would also require investigation on how this affect both and the action and what changes should be done there to acommodate a change like this

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Choose a format for tag ?

2 participants