Skip to content

Commit 8ff9210

Browse files
os-zhuangclaude
andauthored
ci(changeset-check): detect changesets added by the PR, not a non-empty dir (#3376)
The `Check Changeset` gate counted every `.md` in `.changeset/` (`find | wc -l`), so it only asserted the directory was non-empty — never that THIS PR contributed a changeset. In pre-release (RC) mode `changeset version` retains consumed changeset files, so the directory is permanently non-empty and the gate can never go red: #3373 merged a real spec / api-surface fix with no changeset while the step reported "Found 104 changeset(s)". Diff the base commit instead and count only changesets the PR adds. An empty-frontmatter changeset still counts — it is the sanctioned "releases nothing" declaration. Proven to go RED on #3373's diff (0 added) and GREEN on #3360's (1 added). Also backfills the missing #3373 changeset so the ViewFilterRule operator enum fix actually ships in the next release. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ffb83ae commit 8ff9210

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"@objectstack/spec": patch
3+
---
4+
5+
fix(spec): enforce the `ViewFilterRule` operator enum with legacy-alias
6+
normalization (#3373)
7+
8+
`ViewFilterRule.operator` was previously an open string, so views could persist
9+
operators the runtime cannot evaluate. The Zod schema now constrains it to the
10+
supported operator enum and normalizes the known legacy aliases to their
11+
canonical form on parse. This is a public spec/api-surface change
12+
(`packages/spec/api-surface.json`) that landed on `main` in #3373 without a
13+
changeset; this backfills it so the fix ships in the next release instead of
14+
being silently stranded.

.github/workflows/pr-automation.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,31 @@ jobs:
7171
- name: Install dependencies
7272
run: pnpm install --frozen-lockfile
7373

74-
- name: Check for changesets
74+
- name: Check for a changeset added by this PR
75+
env:
76+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
7577
run: |
7678
if [ ! -d ".changeset" ]; then
7779
echo "::warning::.changeset directory not found. Skipping changeset check."
7880
exit 0
7981
fi
80-
CHANGESET_COUNT=$(find .changeset -name '*.md' ! -name 'README.md' | wc -l)
81-
if [ "$CHANGESET_COUNT" -eq 0 ]; then
82-
echo "::error::No changeset found. Add one with 'pnpm changeset' if this PR includes user-facing changes, or apply the 'skip-changeset' label if it doesn't."
82+
# Count changesets THIS PR adds (diff against the base commit), NOT
83+
# the whole .changeset directory. A global `find | wc -l` is unsound:
84+
# in pre-release (RC) mode `changeset version` RETAINS every consumed
85+
# .md file, so the directory is permanently non-empty and the gate can
86+
# never go red. #3373 merged a real spec/api-surface fix with no
87+
# changeset while this step happily reported "Found 104 changeset(s)".
88+
# Diffing against BASE_SHA ignores that residue and sees only what the
89+
# PR itself introduced. An empty-frontmatter changeset still counts —
90+
# it is the sanctioned "this PR releases nothing" declaration, on par
91+
# with the skip-changeset label.
92+
ADDED=$(git diff --name-only --diff-filter=A "$BASE_SHA" HEAD -- '.changeset/*.md' \
93+
| grep -v '/README\.md$' | wc -l | tr -d '[:space:]')
94+
if [ "$ADDED" -eq 0 ]; then
95+
echo "::error::This PR adds no changeset. Run 'pnpm changeset' (an empty changeset is fine for changes that release nothing), or apply the 'skip-changeset' label if it does not need one."
8396
exit 1
84-
else
85-
echo "Found $CHANGESET_COUNT changeset(s)"
8697
fi
98+
echo "This PR adds $ADDED changeset(s)."
8799
88100
- name: Guard against accidental major bumps (launch window)
89101
# Every publishable package is in one Changesets "fixed" (lockstep) group,

0 commit comments

Comments
 (0)