Skip to content

ci: enforce version-only-on-release-branches - #37

Merged
ranxianglei merged 1 commit into
masterfrom
2026-08-08_version-guard
Aug 8, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-08-08_version-guard

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

Adds a hard constraint so version can NEVER be casually bumped — it must go through the standard release flow (§5).

Two layers

1. AGENTS.md §4 — new Version Bumps subsection (sibling to the existing npm Publish prohibition):

  • Rule 1: version changes ONLY on *_release-v* branches
  • Rule 2: a release commit changes ONLY version (+ lockfile drift)
  • Explains WHY (CI trigger detection + merge-conflict avoidance)
  • Canned reply for when a human asks to bundle a version bump into content

2. ci.yml — new version-guard job (enforced, not just documented):

  • Runs on every PR to master
  • If branch is NOT *_release-v* AND the diff touches "version" in package.json → job fails with ::error
  • Release branches (*_release-v*) skip the check

Verified locally

  • Non-release branch + version change → guard fires ✗ (blocks correctly)
  • Non-release branch + no version change → guard silent ✓
  • Release branch pattern → skip ✓

Why

Prevents the exact failure that hit PR#32: version bundled into a non-release context → three-way merge conflict + broken CI trigger. With this guard that PR would have failed CI before merge.

No version field changed in this PR (the guard runs on itself ✓). Docs + CI only.

Adds two layers of protection so the 'version' field can never be casually
bumped:

1. AGENTS.md §4 — new 'Version Bumps' subsection (sibling to the npm Publish
   prohibition): two hard rules — version changes ONLY on *_release-v*
   branches, and a release commit changes ONLY version. Includes the reason
   (CI trigger detection + merge-conflict avoidance) and a canned reply for
   when a human asks to bundle a version bump into content.

2. ci.yml — new 'version-guard' job that runs on every PR: if the branch is
   NOT *_release-v* and the diff touches the '"version"' line in
   package.json, the job fails with a ::error annotation. Release branches
   skip the check.

This prevents the exact failure that hit PR#32 (version bundled into a
non-release context → three-way merge conflict + broken CI trigger).
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