fix(version): exit with code 1 when no unreleased changesets found - #1860
Merged
Andarist merged 5 commits intoMay 4, 2026
Merged
Conversation
Previously, 'changeset version' would warn about no changesets and then exit successfully (code 0), making it difficult to detect in CI pipelines when the version step was a no-op. This was especially problematic when using '--snapshot' mode: if there were no changesets, the subsequent publish step would still run and could publish packages with incorrect version tags. Throwing ExitError(1) instead of silently returning ensures that CI pipelines can detect and handle the no-changesets case. Fixes changesets#1815
🦋 Changeset detectedLatest commit: 21e5fe2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #1860 +/- ##
=======================================
Coverage 81.85% 81.85%
=======================================
Files 54 54
Lines 2441 2441
Branches 715 716 +1
=======================================
Hits 1998 1998
Misses 401 401
Partials 42 42 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
This is a breaking change. I'm a little bit on the fence right now and I'd prefer not introduce those in a minor release. |
Member
|
Should we move this to the next branch? I think this is an ok change. |
Andarist
reviewed
May 4, 2026
beeequeue
requested changes
May 4, 2026
Co-authored-by: Adam Haglund <adam@haglund.dev>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1815
changeset versioncurrently exits with code 0 when no unreleased changesets are found, even though it has done nothing. This makes CI pipelines unable to detect the no-op case, which can lead to subtle bugs — for example when using--snapshotmode:Changes
packages/cli/src/commands/version/index.ts: Replacereturnwiththrow new ExitError(1)when no unreleased changesets are foundpackages/cli/src/commands/version/version.test.ts: Update the no-changesets test to assert that anExitErroris thrown with code 1.changeset/fix-version-no-changesets-exit-code.md: Changeset describing the patchMigration
CI pipelines that currently call
changeset versionand ignore the exit code will need to handle the new exit code 1. A typical pattern would be: