Skip to content

Commit 8614f21

Browse files
committed
ci: add CI for checking generated changesets
1 parent b807700 commit 8614f21

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/tests.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
1719

1820
- name: Setup Node.js
1921
uses: actions/setup-node@v4
@@ -31,6 +33,39 @@ jobs:
3133
- name: Run format check
3234
run: pnpm format
3335

36+
- name: Check for changesets
37+
run: |
38+
# For pull requests, compare against the base branch
39+
if [ "${{ github.event_name }}" = "pull_request" ]; then
40+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
41+
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
42+
else
43+
# For pushes to main, compare against the previous commit
44+
BASE_SHA="${{ github.event.before }}"
45+
HEAD_SHA="${{ github.event.after }}"
46+
fi
47+
48+
# Check if there are any changes to packages that would need a release
49+
if git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -E '^(packages/|src/)' > /dev/null; then
50+
if [ -z "$(ls .changeset/*.md 2>/dev/null)" ]; then
51+
echo "❌ Changes detected in packages but no changesets found."
52+
echo ""
53+
echo "Please create a changeset with 'pnpm changeset' for changes that should be released."
54+
echo "If these changes don't need a release, please add a comment explaining why."
55+
echo ""
56+
echo "Changed files:"
57+
git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -E '^(packages/|src/)' || true
58+
exit 1
59+
else
60+
echo "✅ Found changesets for package changes"
61+
echo ""
62+
echo "Changesets:"
63+
ls .changeset/*.md
64+
fi
65+
else
66+
echo "ℹ️ No package changes detected, skipping changeset check"
67+
fi
68+
3469
test:
3570
runs-on: ubuntu-latest
3671
needs: quality

0 commit comments

Comments
 (0)