Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,18 @@ jobs:
uses: danielroe/provenance-action@v0.1.1
with:
fail-on-downgrade: true
- 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
Copy Markdown
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".

- name: Echo result
run: echo $FOUND
env:
FOUND: ${{ steps.major.outputs.found }}
13 changes: 12 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ jobs:
- name: Stop Nx Agents
if: ${{ always() }}
run: npx nx-cloud stop-all-agents
- 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: Run Changesets (version or publish)
id: changesets
uses: changesets/action@v1.5.3
Expand All @@ -49,7 +60,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Auto-merge Changesets PR
if: steps.changesets.outputs.hasChangesets == 'true'
if: steps.changesets.outputs.hasChangesets == 'true' && steps.major.outputs.found == 'false'
run: |
gh pr merge --squash "$PR_NUMBER"
gh api --method POST /repos/$REPO/dispatches -f 'event_type=release'
Expand Down
5 changes: 5 additions & 0 deletions grumpy-plants-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/query-core': major
---

TEST
Loading