-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
ci: introduce changesets #9502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: introduce changesets #9502
Conversation
View your CI Pipeline Execution β for commit 64146bf
βοΈ Nx Cloud last updated this comment at |
Sizes for commit 64146bf:
|
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9502 +/- ##
=======================================
Coverage 46.38% 46.38%
=======================================
Files 214 214
Lines 8488 8488
Branches 1919 1921 +2
=======================================
Hits 3937 3937
Misses 4108 4108
Partials 443 443 π New features to boost your workflow:
|
WalkthroughAdds Changesets-based release tooling and config, replaces a custom publish script and CI publish step with Changesets steps, updates package scripts and devDependencies, introduces a PR template, updates CONTRIBUTING, and adjusts one integration package.json metadata. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant Repo as Repository
participant CI as GitHub Actions
participant CS as Changesets Action
participant Registry as Package Registry
Dev->>Repo: Push commits (may include a changeset)
activate CI
CI->>CI: Run tests & checks
CI->>CS: Run `changeset version`
CS-->>Repo: Create version & changelog updates
CI->>Repo: Commit & push version files (GITHUB_TOKEN)
deactivate CI
Dev->>Repo: Merge PR / push to main
activate CI
CI->>CS: Run `changeset publish`
CS->>Registry: Publish packages
CS-->>Repo: Update releases/changelogs
deactivate CI
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~25 minutes Poem
Pre-merge checks and finishing touchesβ Passed checks (3 passed)
β¨ Finishing touchesπ§ͺ Generate unit tests
π Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro π Files selected for processing (1)
π§ Files skipped from review as they are similar to previous changes (1)
β° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Comment |
97cd385
to
fd8e6f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
π§Ή Nitpick comments (5)
package.json (2)
32-34
: Add a status script for local DX.Consider adding a convenience script to preview pending releases locally.
Apply:
"prettier:write": "pnpm run prettier --write", "docs:generate": "node scripts/generateDocs.ts", "verify-links": "node scripts/verify-links.ts", "changeset": "changeset", "changeset:version": "changeset version && pnpm install --no-frozen-lockfile && pnpm prettier:write", "changeset:publish": "changeset publish" + ,"changeset:status": "changeset status --since=origin/main"
47-47
: Changelog provider dependency: LGTM; document its output style.Looks good. Consider mentioning in CONTRIBUTING the βgithubβcompactβ format so contributors know what to expect in PRs.
.github/pull_request_template.md (1)
7-9
: Fix link to the correct Contributing guide in this repo.The template points to TanStack/config. Link should reference TanStack/query.
Apply:
- - [ ] I have followed the steps listed in the [Contributing guide](https://github.com/TanStack/config/blob/main/CONTRIBUTING.md). + - [ ] I have followed the steps listed in the [Contributing guide](https://github.com/TanStack/query/blob/main/CONTRIBUTING.md).CONTRIBUTING.md (2)
158-160
: Typo: duplicate βrunβ.Small nit.
-This repo uses [Changesets](...) to automate releases. If your PR should release a new package version (patch, minor, or major), please run run `pnpm changeset` and commit the file. +This repo uses [Changesets](...) to automate releases. If your PR should release a new package version (patch, minor, or major), please run `pnpm changeset` and commit the file.
170-170
: Clarify when the preview PR is created.Make it explicit that the preview PR appears only when changesets are present.
-For each new commit added to `main`, a GitHub Workflow is triggered which runs the Changesets Action. This generates a preview PR showing the impact of all changesets. When this PR is merged, the package will be published to NPM. +On pushes to `main`, a GitHub Workflow runs the Changesets Action. If there are pending changesets, it opens/updates a preview PR showing the release impact. When that PR is merged, packages are published to npm.
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
β Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
π Files selected for processing (7)
.changeset/config.json
(1 hunks).github/pull_request_template.md
(1 hunks).github/workflows/release.yml
(3 hunks)CONTRIBUTING.md
(2 hunks)integrations/angular-cli-20/package.json
(1 hunks)package.json
(2 hunks)scripts/publish.ts
(0 hunks)
π€ Files with no reviewable changes (1)
- scripts/publish.ts
β° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
π Additional comments (6)
package.json (1)
44-44
: Changesets CLI dependency: LGTM.Pinned to a recent version; aligns with the workflow step.
.changeset/config.json (1)
2-13
: Config aligns with the Action usage.
- githubβcompact changelog with repo set: OK
- commit: false pairs fine with the Actionβs commit/title inputs
- baseBranch/main and public access: OK
No changes required.
.github/workflows/release.yml (2)
17-17
: Permission update: LGTM.pull-requests: write is required for the Changesets Action to open/update the version PR.
38-47
: Consider reβadding a manual trigger for emergency/forced releases.You removed workflow_dispatch; maintainers asked about manual releases previously. Reβintroducing it keeps flexibility for hotfixes.
Apply:
on: - push: + push: branches: [main, alpha, beta, rc, v4] + workflow_dispatch: + inputs: + mode: + description: "Run version or publish" + required: false + default: "auto" + type: choice + options: + - auto + - version + - publishOptionally gate the step:
- - name: Run Changesets (version or publish) + - name: Run Changesets (version or publish) uses: changesets/[email protected] with: - version: pnpm run changeset:version - publish: pnpm run changeset:publish + version: ${{ inputs.mode == 'publish' && 'false' || 'pnpm run changeset:version' }} + publish: ${{ inputs.mode == 'version' && 'false' || 'pnpm run changeset:publish' }} commit: 'ci: Version Packages' title: 'ci: Version Packages'CONTRIBUTING.md (1)
164-167
: Commit message guidance: keep a concise convention section.You removed the detailed conventions but still ask for βappropriate commit type.β Consider adding a short section and link (as suggested in review discussion).
Proposed snippet:
### Commit messages (short guideline) We squash-merge, so write clear, imperative messages (e.g., "Fix flaky test"). Conventional types are optional, but recommended for clarity. See a concise example in Zustandβs guide: https://github.com/pmndrs/zustand/blob/main/CONTRIBUTING.md#committingintegrations/angular-cli-20/package.json (1)
3-3
: Marking package private: good β confirm TypeScript range for Angular CLI v20npm shows @angular/compiler-cli 20.0.0β20.1.7 require typescript ">=5.8 <5.9"; starting at 20.2.0 the range is ">=5.8 <6.0". If this integration uses 20.0/20.1 pin TypeScript to ~5.8.x; if it targets >=20.2 you may allow up to <6.0. Check integrations/angular-cli-20/package.json for the exact @angular/* versions and align the TypeScript devDependency accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (1)
.github/workflows/release.yml
(2 hunks)
π Additional comments (5)
.github/workflows/release.yml (5)
1-1
: LGTM: Clear workflow name changeThe workflow name change from "ci" to "Release" better reflects its purpose and aligns with the introduction of changesets for release management.
14-16
: LGTM: Appropriate permissions for changesets workflowThe permissions correctly include
contents: write
for pushing version commits andid-token: write
for npm publishing with OIDC, which aligns with modern secure publishing practices.
29-29
: Confirmed: .nx/workflows/dynamic-changesets.yaml exists
Found .nx/workflows/dynamic-changesets.yaml with distribute-on mappings (small-changeset, medium-changeset, large-changeset); no further action required.
37-38
: No action required β changeset:version script presentpackage.json defines "changeset:version" as: changeset version && pnpm install --no-frozen-lockfile && pnpm prettier:write
47-50
: changeset:publish exists β verify NPM_TOKEN secretpackage.json defines "changeset:publish" -> "changeset publish" and the workflow uses NPM_TOKEN from secrets (.github/workflows/release.yml lines 47β50). Ensure the repository/GitHub Actions secret NPM_TOKEN is present and contains a valid npm token with publish permissions for the registry used.
- name: Commit version files | ||
run: | | ||
git config --global user.name 'Tanner Linsley' | ||
git config --global user.email '[email protected]' | ||
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | ||
pnpm run cipublish | ||
git config --global user.email '[email protected]' git add -A | ||
git commit -m "ci: Version Packages" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix git configuration and add conditional logic for version commits
The current implementation has several issues:
- Line 42 has a syntax error - missing newline between email and
git add
- The commit will fail if there are no changes to commit
- No validation that version changes actually occurred
- name: Commit version files
run: |
git config --global user.name 'Tanner Linsley'
- git config --global user.email '[email protected]' git add -A
- git commit -m "ci: Version Packages"
- git push
+ git config --global user.email '[email protected]'
+ git add -A
+ if git diff --staged --quiet; then
+ echo "No version changes to commit"
+ else
+ git commit -m "ci: Version Packages"
+ git push
+ fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- name: Commit version files | |
run: | | |
git config --global user.name 'Tanner Linsley' | |
git config --global user.email '[email protected]' | |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | |
pnpm run cipublish | |
git config --global user.email '[email protected]' git add -A | |
git commit -m "ci: Version Packages" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit version files | |
run: | | |
git config --global user.name 'Tanner Linsley' | |
git config --global user.email '[email protected]' | |
git add -A | |
if git diff --staged --quiet; then | |
echo "No version changes to commit" | |
else | |
git commit -m "ci: Version Packages" | |
git push | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
π€ Prompt for AI Agents
.github/workflows/release.yml around lines 39 to 46: fix the malformed git
command by placing the git add on its own line after configuring user.email, and
add conditional checks so the workflow only attempts to commit/push when version
files actually changed; implement a pre-commit check that detects changes (e.g.,
git diff --name-only or git status --porcelain) and only run git add/commit/push
if that check finds relevant files (validate by matching expected version files
or package manifests), otherwise skip committing to avoid failure when there are
no changes.
There is one disadvantage of using Changesets over the current setup, though I'm not sure if it's a valid point for you to consider here. With the current setup, people subscribing to GitHub releases receive a single notification/a single release on the releases page. With Changesets, however, there would be tons. A "RELEASE ALL" in the query repo would make 23 releases and send 23 notifications to subscribers. |
Hey @AhmedBaset , it's definitely quite noisy. One "solution" is to disable release notifications by choosing custom watch events. If you want to keep these notifications though, I don't think there is a way to merge them together, sorry! ![]() |
π― Changes
As discussed on Discord (private channel): https://discord.com/channels/719702312431386674/1345158793675276319
See also: TanStack/config#218 and TanStack/virtual#946
β Checklist
pnpm test:pr
.π Release Impact
Summary by CodeRabbit
Chores
Documentation
CI