Skip to content
Merged
Changes from 1 commit
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
12 changes: 11 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ 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)"
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.

done
- name: Run Changesets (version or publish)
id: changesets
uses: changesets/action@v1.5.3
Expand All @@ -49,7 +59,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
Loading