Skip to content

Conversation

lachlancollins
Copy link
Member

@lachlancollins lachlancollins commented Sep 27, 2025

🎯 Changes

Switches to the official changesets/action, but uses gh pr merge to auto-merge its release PR.

Solution taken from changesets/action#310 (comment)

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Chores
    • Switched release pipeline to a PR-driven Changesets workflow for versioning and publishing.
    • Enabled automatic merge of generated version bump PRs when changes are detected.
    • Consolidated separate versioning and publishing steps into a single automated flow.
    • Updated release automation to support token-based publishing.
    • Adjusted coverage upload to work seamlessly with the new PR-based process.
    • Removed manual commit/push steps from the release process to streamline automation.

Copy link

changeset-bot bot commented Sep 27, 2025

⚠️ No Changeset found

Latest commit: 64facb8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

coderabbitai bot commented Sep 27, 2025

Walkthrough

The release workflow in .github/workflows/release.yml is refactored to use the Changesets GitHub Action for versioning and publishing, removes manual git commit/push steps, adds PR-based auto-merge logic, introduces NPM_TOKEN usage, exposes PR/REPO inputs for downstream steps, and preserves Codecov upload with updated context.

Changes

Cohort / File(s) Summary of changes
Release workflow modernization
.github/workflows/release.yml
Replace manual “Version Packages” and local commit/push with changesets/action@v1.5.3 handling version/publish; configure commit message/title; add NPM_TOKEN to Changesets flow; add auto-merge of generated Changesets PR; introduce PR_NUM and REPO inputs for downstream steps; retain Codecov upload with PR-based context; consolidate publish into Changesets action.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub Actions: release.yml
  participant CS as Changesets Action
  participant GHPR as Pull Requests
  participant NPM as npm Registry
  participant CV as Codecov

  Dev->>GH: Push changes / trigger workflow
  GH->>CS: Run Changesets (version or publish)
  alt Version required
    CS->>GHPR: Create/Update "Version Packages" PR
    GH->>GHPR: Auto-merge PR (squash) when ready
    GH->>CS: Re-run to publish (post-merge)
  else No version changes
    CS-->>GH: No-op for version
  end
  CS->>NPM: Publish packages (uses NPM_TOKEN)
  GH->>CV: Upload coverage (PR-aware context)
  note over GH,NPM: PR-based merge/publish replaces local git commit/push
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ci: introduce changesets #9502 — Migrates release workflow to Changesets with similar CI version/publish restructuring, closely mirroring this PR’s changes to .github/workflows/release.yml.

Poem

I thump the ground—release day cheer!
Changesets hop; the path is clear.
No more local pushy frights,
PRs merge soft on moonlit nights.
Tokens packed, we npm-fly—
Codecov waves a carrot high.
Ship it, sip it—lettuce sky! 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title concisely describes the primary update to the CI configuration by specifying that it “updates changesets auto-merge logic,” and it uses the standard “ci:” prefix to indicate the context. This aligns directly with the workflow changes to auto-merge release PRs using changesets/action and gh pr merge. Therefore, the title is clear, focused, and accurately reflects the main change in the pull request.
Description Check ✅ Passed The pull request description follows the repository’s template by including the “🎯 Changes” section with a clear explanation of the workflow update, the “✅ Checklist” section reflecting contributions and test status, and the “🚀 Release Impact” section with the appropriate options checked. All required section headings and checklist items are present and correctly represented for a docs/CI/dev-only change. As such, it adheres to the template structure and content requirements.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch changesets-auto-merge

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3252c96 and 64facb8.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (1 hunks)
⏰ 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). (1)
  • GitHub Check: Test
🔇 Additional comments (1)
.github/workflows/release.yml (1)

48-54: Guard the merge step with an explicit boolean check.

steps.changesets.outputs.hasChangesets is the string 'true'/'false'. In GitHub Actions any non-empty string is truthy, so this step still runs when the output is 'false', leaving PR_NUM empty and making gh pr merge fail on release runs without pending changesets. Compare the output to 'true' before invoking the CLI.

-      - name: Auto-merge Changesets PR
-        if: steps.changesets.outputs.hasChangesets
+      - name: Auto-merge Changesets PR
+        if: steps.changesets.outputs.hasChangesets == 'true'

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

nx-cloud bot commented Sep 27, 2025

View your CI Pipeline Execution ↗ for commit 64facb8

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 1m 30s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-27 22:52:44 UTC

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e8fd61 and 3252c96.

📒 Files selected for processing (2)
  • .github/workflows/release.yml (1 hunks)
  • packages/query-core/src/index.ts (1 hunks)
⏰ 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). (1)
  • GitHub Check: Test

Comment on lines 48 to 54
- name: Auto-merge Changesets PR
if: steps.changesets.outputs.hasChangesets
run: gh pr --repo "$REPO" merge --auto --squash "$PR_NUM"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Packages
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
pnpm run changeset:publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PR_NUM: ${{ steps.changesets.outputs.pullRequestNumber }}
REPO: ${{ github.repository }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Guard the auto-merge step correctly.

steps.changesets.outputs.hasChangesets is a string ('true'/'false'). Without an explicit comparison, the step still runs when the value is 'false', leaving PR_NUM empty and making gh pr merge fail, which will break every release run without pending changesets. Compare the output to 'true' so we only invoke the CLI when a release PR actually exists.

-      - name: Auto-merge Changesets PR
-        if: steps.changesets.outputs.hasChangesets
+      - name: Auto-merge Changesets PR
+        if: steps.changesets.outputs.hasChangesets == 'true'
📝 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.

Suggested change
- name: Auto-merge Changesets PR
if: steps.changesets.outputs.hasChangesets
run: gh pr --repo "$REPO" merge --auto --squash "$PR_NUM"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Packages
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
pnpm run changeset:publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PR_NUM: ${{ steps.changesets.outputs.pullRequestNumber }}
REPO: ${{ github.repository }}
- name: Auto-merge Changesets PR
if: steps.changesets.outputs.hasChangesets == 'true'
run: gh pr --repo "$REPO" merge --auto --squash "$PR_NUM"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUM: ${{ steps.changesets.outputs.pullRequestNumber }}
REPO: ${{ github.repository }}
🤖 Prompt for AI Agents
.github/workflows/release.yml lines 48-54: the step uses if:
steps.changesets.outputs.hasChangesets which is a string and can be 'false' but
still considered truthy by Actions; change the if to explicitly compare the
output to the string 'true' (e.g., if: steps.changesets.outputs.hasChangesets ==
'true') so the auto-merge runs only when a release PR exists and PR_NUM is set.

Copy link

pkg-pr-new bot commented Sep 27, 2025

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@9703

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@9703

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@9703

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@9703

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@9703

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@9703

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@9703

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@9703

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@9703

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@9703

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@9703

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@9703

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@9703

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@9703

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@9703

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@9703

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@9703

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@9703

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@9703

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@9703

commit: 64facb8

Copy link
Contributor

Sizes for commit 64facb8:

Branch Bundle Size
Main
This PR

@lachlancollins lachlancollins merged commit 1bcdf09 into main Sep 27, 2025
7 checks passed
@lachlancollins lachlancollins deleted the changesets-auto-merge branch September 27, 2025 22:54
Hellol77 pushed a commit to Hellol77/query that referenced this pull request Oct 14, 2025
* ci: update changesets auto-merge logic

* Intentionally breaking build

* Undo intentional break

* Remove auto since we don't have auto-merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant