Repository navigation
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 <[email protected]>
ByronDWall
pushed a commit
to commercetools/nimbus
that referenced
this pull request
Sep 23, 2026
…1995) * ci(release): upgrade changesets/action to v2 for @changesets/cli v3 @changesets/cli v3 no longer prints the "New tag: <pkg>@<version>" lines that changesets/action v1.9.0 scraped to learn which packages were published. The action therefore saw zero published packages: it pushed no git tags, created no GitHub releases, and set published=false -- while npm publishing itself succeeded. 3.6.0 reached npm with no GitHub release history because of this, and the publish step still reported success. Two v3 breaking changes combined to produce the failed run: - Published-package detection moved from stdout parsing to a shared output file named by CHANGESETS_OUTPUT (changesets/action#678). Action v1 has no such support and reported published=false, which skipped tagging and releases and also un-gated the canary step below. - `changeset version` now exits 1 when there are no unreleased changesets (changesets/changesets#1860); v2 exited 0 silently. That turned the un-gated canary step into a hard job failure. Upstream treats these as a matched pair and action v2 validates it, refusing CLI v2 (changesets/action#699). There is no equivalent check in v1 for CLI v3, which is why the mismatch degraded silently instead of failing fast. Changes: - changesets/action v1.9.0 -> v2.1.2, using v2's renamed kebab-case inputs and passing the app token through the `github-token` input, which is now required for custom tokens. `commitMode: github-api` is dropped because v2 uses the GitHub API by default. - Guard both canary steps on the presence of changeset files, so an emptied .changeset/ is a clean skip rather than exit 1. - Add a step asserting that the version present on npm has a matching git tag, so a silent tagging failure fails the job instead of reporting success. - Remove scripts/print_release_version.sh and its step. Its output was read nowhere in the workflow, its exit code was swallowed by the surrounding command substitution, and it ran `changeset version` followed by `git reset --hard` inside the release job. Co-Authored-By: Claude Opus 5 <[email protected]> * ci(release): trim the comments added with the changesets v2 upgrade The explanatory blocks restated the commit message and PR description, which git blame already reaches, and ran six to eight lines in a file whose idiom is one- to three-line constraint notes. Keep only what is not visible in the code and would be re-broken if removed: that the action and CLI majors move together, that the tag check is deliberately independent of the action's own report, and why the canary steps test for changeset files before versioning. Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]>
10 of 18 tasks
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: