Skip to content

Conversation

lachlancollins
Copy link
Member

@lachlancollins lachlancollins commented Sep 28, 2025

🎯 Changes

If a changeset is marked to release a major, it should not run the auto-merge logic.

Inspired by https://github.com/withastro/astro/blob/main/.github/workflows/check-merge.yml

✅ 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

    • CI release workflow now detects changesets marked as "major" and sets a flag before running release steps.
    • Auto-merge of changesets is blocked when a major changeset is present, requiring manual merge.
    • PR provenance job now checks for major changesets and exposes the result for visibility.
  • Documentation

    • Build notes updated to indicate a major version bump for a dependency.

Copy link

changeset-bot bot commented Sep 28, 2025

⚠️ No Changeset found

Latest commit: 8e2a348

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 28, 2025

Caution

Review failed

The head commit changed during the review from 3d703c9 to 8e2a348.

Walkthrough

Adds steps to detect "major" changesets in CI: new major-detection steps in PR and release workflows that set an output flag, and the release workflow's Changesets auto-merge step is gated to only run when no major changeset is found. Also updates build doc noting a dependency major bump.

Changes

Cohort / File(s) Summary
Release workflow
.github/workflows/release.yml
Adds a pre-run step that scans .changeset/*.md for the string "major" and sets an output flag (found=true when present); updates the Auto-merge Changesets step condition to require that flag be false before auto-merging.
PR workflow
.github/workflows/pr.yml
Adds two steps to the Provenance job: a "Check for Changesets marked as major" scanner that sets an output flag, and an "Echo result" step that prints the flag. These run unconditionally as part of the job.
Docs / build note
grumpy-plants-build.md
Adds a short note indicating a major version bump for @tanstack/query-core and a TEST marker (documentation/build note only).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant GH as GitHub Actions
  participant Release as release.yml
  participant PRjob as pr.yml Provenance
  participant MajorCheck as Major-check Step
  participant Changesets as Changesets Run
  participant AutoMerge as Auto-merge Changesets

  GH->>PRjob: Run PR workflow (provenance)
  PRjob->>MajorCheck: Scan `.changeset/*.md` for "major"
  MajorCheck-->>PRjob: output found = true/false
  PRjob->>GH: Echo found

  GH->>Release: Run release workflow
  Release->>MajorCheck: Scan `.changeset/*.md` for "major"
  MajorCheck-->>Release: output found = true/false
  Release->>Changesets: Run Changesets
  alt found == false
    Release->>AutoMerge: Condition ok -> Auto-merge
    AutoMerge-->>GH: Merge performed
  else found == true
    Release--x AutoMerge: Auto-merge skipped (major present)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • TkDodo

Poem

I twitch my ears at CI light,
I sniff for "major" through the night.
If a big change wakes my nose, I stall—
No gentle merge, I guard the wall.
If fields are calm, I hop and cheer, merge bright 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title “ci(release): do not auto-merge major releases” succinctly and accurately describes the primary change of the pull request, namely updating the CI release workflow to prevent auto-merging when a changeset is marked as a major release. It is concise, clear, and directly reflects the main point of the changeset.
Description Check ✅ Passed The pull request description adheres to the repository’s template by providing a clear “🎯 Changes” section describing the motivation and implementation, a completed “✅ Checklist” confirming adherence to the contributing guide and local testing, and a correctly filled “🚀 Release Impact” section indicating that this is a docs/CI/dev-only change with no published code changes. All required sections and items are present and appropriately completed.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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

Copy link

nx-cloud bot commented Sep 28, 2025

View your CI Pipeline Execution ↗ for commit 8e2a348

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

☁️ Nx Cloud last updated this comment at 2025-09-28 00:40:44 UTC

Copy link

pkg-pr-new bot commented Sep 28, 2025

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 8e2a348

Copy link
Contributor

github-actions bot commented Sep 28, 2025

Sizes for commit 8e2a348:

Branch Bundle Size
Main
This PR

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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dcc7bd9 and 6523b5f.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (2 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). (2)
  • GitHub Check: Preview
  • GitHub Check: Test

Comment on lines 45 to 48
for file in ".changeset/*.md"; do
if [[ $(cat $file) =~ $regex ]]; then
echo "found=true" >> $GITHUB_OUTPUT
fi
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

Fix the glob so major changesets are actually detected.

With the loop written as for file in ".changeset/*.md"; do, the shell never expands the wildcard—the body runs once against the literal string .changeset/*.md. That means cat fails, found never flips to true, and majors are still auto-merged. Please drop the quotes (and guard the read) so real files are inspected.

-          for file in ".changeset/*.md"; do
-            if [[ $(cat $file) =~ $regex ]]; then
-              echo "found=true" >> $GITHUB_OUTPUT
-            fi
-          done
+          shopt -s nullglob
+          for file in .changeset/*.md; do
+            if [[ -f "$file" && $(<"$file") =~ $regex ]]; then
+              echo "found=true" >> "$GITHUB_OUTPUT"
+              break
+            fi
+          done
📝 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
for file in ".changeset/*.md"; do
if [[ $(cat $file) =~ $regex ]]; then
echo "found=true" >> $GITHUB_OUTPUT
fi
shopt -s nullglob
for file in .changeset/*.md; do
if [[ -f "$file" && $(<"$file") =~ $regex ]]; then
echo "found=true" >> "$GITHUB_OUTPUT"
break
fi
done
🤖 Prompt for AI Agents
.github/workflows/release.yml lines 45-48: the for-loop uses a quoted glob ("
.changeset/*.md") so the shell doesn't expand it and the loop iterates once over
the literal string; remove the quotes so the glob expands (for file in
.changeset/*.md; do) and add a guard to ensure the path is a real file before
reading (e.g., if [ -f "$file" ]; then ... fi), also quote the $file when
passing to cat or other commands to handle spaces.

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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6523b5f and 00af74e.

📒 Files selected for processing (3)
  • .github/workflows/pr.yml (1 hunks)
  • .github/workflows/release.yml (2 hunks)
  • grumpy-plants-build.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • grumpy-plants-build.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release.yml
⏰ 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 87 to 97
- name: Check for Changesets marked as major
id: major
run: |
echo "found=false" >> $GITHUB_OUTPUT
regex="(major)"
shopt -s nullglob
for file in .changeset/*.md; do
if [[ $(cat $file) =~ $regex ]]; then
echo "found=true" >> $GITHUB_OUTPUT
fi
done
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 | 🟠 Major

Restrict major detection to the changeset frontmatter

Scanning the entire markdown body for the literal "major" will flag perfectly valid non-major changesets whose description happens to use that word (e.g. “Major docs cleanup”), which in turn blocks the auto-merge workflow unnecessarily. We should only examine the frontmatter bump declarations when deciding if a changeset is major. Example adjustment:

       - name: Check for Changesets marked as major
         id: major
         run: |
           echo "found=false" >> $GITHUB_OUTPUT
           shopt -s nullglob
           for file in .changeset/*.md; do
-            if [[ $(cat $file) =~ $regex ]]; then
-              echo "found=true" >> $GITHUB_OUTPUT
-            fi
+            if awk 'BEGIN { fm=0; found=0 }
+              /^---$/ { fm++; if (fm >= 2) exit }
+              fm == 1 && $0 ~ /:\s*(\"|\047)?major(\"|\047)?\s*$/ { exit 0 }
+              END { exit 1 }
+            ' "$file"; then
+              echo "found=true" >> $GITHUB_OUTPUT
+              break
+            fi
           done

This keeps the step lightweight while avoiding false positives by checking only the release bump definitions between the --- delimiters.

📝 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: Check for Changesets marked as major
id: major
run: |
echo "found=false" >> $GITHUB_OUTPUT
regex="(major)"
shopt -s nullglob
for file in .changeset/*.md; do
if [[ $(cat $file) =~ $regex ]]; then
echo "found=true" >> $GITHUB_OUTPUT
fi
done
- name: Check for Changesets marked as major
id: major
run: |
echo "found=false" >> $GITHUB_OUTPUT
regex="(major)"
shopt -s nullglob
for file in .changeset/*.md; do
if awk 'BEGIN { fm=0; found=0 }
/^---$/ { fm++; if (fm >= 2) exit }
fm == 1 && $0 ~ /:\s*(\"|\047)?major(\"|\047)?\s*$/ { exit 0 }
END { exit 1 }
' "$file"; then
echo "found=true" >> $GITHUB_OUTPUT
break
fi
done
🤖 Prompt for AI Agents
In .github/workflows/pr.yml around lines 87 to 97, the job currently scans
entire changeset markdown for the literal "major" causing false positives;
change the loop to read only the frontmatter (the content between the first pair
of '---' delimiters) for each .changeset/*.md and test that substring for the
bump type "major" (or the specific frontmatter key/value used for bumps) before
setting found=true; keep the same lightweight shell loop and nullglob but
replace the body so it extracts frontmatter only and checks within that scope
for "major".

@lachlancollins lachlancollins merged commit 4cf6a9a into main Sep 28, 2025
7 checks passed
@lachlancollins lachlancollins deleted the gate-major-release branch September 28, 2025 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant