Conversation
Signed-off-by: Alexandre Philibeaux <aphilibeaux@scaleway.com>
✅ Deploy Preview for changesets ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 7ffc907 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 @@
## main #2293 +/- ##
==========================================
+ Coverage 84.57% 84.68% +0.10%
==========================================
Files 80 81 +1
Lines 3177 3199 +22
Branches 896 897 +1
==========================================
+ Hits 2687 2709 +22
Misses 433 433
Partials 57 57 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Adds a new
changeset checkcommand that validates every changeset in.changeset/is well-formed and only references packages that still exist in the workspace. Designed to run in CI onmain(or on PRs) to catch malformed or stale changesets before they breakchangeset versionduring a release.Problem
When changesets are created or edited by hand (or by an AI tool), they can end up:
These errors currently surface during
changeset versionon the release branch, blocking the release.changeset statuscatches them too, but it also runs git (diffing againstbaseBranch/--since) and exits 1 when there are changed packages without changesets — which makes it unsuitable as a pure validation check onmain.Solution
changeset checkreuses the existingreadChangesets+assembleReleasePlanpipeline:readChangesetsparses each.changeset/*.mdfile → throws on malformed format (missing frontmatter, invalid YAML, bad version type, etc.)assembleReleasePlanvalidates that every referenced package exists in the workspace → throwsFound changeset X for package Y which is not in the workspaceIt reads only the working tree (no
--since, no git diff), so it works in shallow CI clones and merge-commit checkouts without depending on git history.What it does NOT do
status, which callsgit diffagainstbaseBranch/--since)status's job, and intentionally not recommended for CI)Files
packages/cli/src/commands/check/index.ts— the command (~45 lines, reusesreadChangesets+assembleReleasePlan)packages/cli/src/cli.ts— registers thecheckcommandpackages/cli/src/commands/check/__tests__/check.test.ts— 7 tests (valid, empty--emptychangeset, no changesets, stale package ref, malformed frontmatter, invalid version type, no-fail-when-changed-packages-have-no-changeset)packages/cli/src/cli.test.ts— CLI wiring testdocs/command-line-options.md+docs/checking-for-changesets.md— docsTest plan
pnpm types:checkpnpm lintpnpm formatpnpm test run packages/cli/src/cli.test.ts(30 passed)pnpm test run packages/cli/src/commands/check(7 passed)node packages/cli/bin.js checkon this repo →All 2 changeset(s) are valid.Found changeset X for package Y which is not in the workspace