feat: PR-based release flow for alpha; test suite proving all three release properties#4431
Merged
matthew-dean merged 5 commits intomasterfrom Mar 19, 2026
Merged
Conversation
- create-release-pr.yml: add set -euo pipefail; track whether a commit was created; skip push + gh pr create when no version changes (no-op safety - fixes the "no commits between head and base" failure). - scripts/bump-and-publish.js: on master, use the version already in package.json as-is (no auto-increment). Validate it is > NPM version. Skip updateAllVersions/git-add/git-commit on master so the published tag always points to the release PR merge commit on master, not to a local detached commit. Alpha behavior is unchanged. - Fix error message: on master say "Git tag was pushed" rather than "Version bump commit and tag were pushed". Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix release automation scripts for version bumps and publishing
fix: release automation — no-op safety in create-release-pr and read-only master publish
Mar 19, 2026
Proves the three components of the release flow work correctly:
- publish.yml if: conditions (6 scenarios)
- create-release-pr.yml if: conditions (4 scenarios)
- bump-and-publish.js master path: existing version, no commit, no push (4 tests)
- bump-and-publish.js alpha path: auto-increment, commit, alpha tag (4 tests)
- create-release-pr no-op safety: commit when needed, clean exit when not (2 tests)
Run with: node scripts/test-release-automation.js
or: npm run test:release (after pnpm install)
Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com>
Copilot
AI
changed the title
fix: release automation — no-op safety in create-release-pr and read-only master publish
fix: correct release automation — no-op safety in create-release-pr and read-only master publish
Mar 19, 2026
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip You can disable poems in the walkthrough.Disable the |
Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com>
- create-release-pr.yml: listen on alpha push; compute alpha version increment (X.Y.Z-alpha.N → X.Y.Z-alpha.N+1); use branch-specific PR title/base/branch naming; update loop guards for both flavours - publish.yml: remove push:alpha trigger; add alpha to pull_request branches; update if: condition for alpha release PR title+base - bump-and-publish.js: remove auto-increment/commit/push for alpha; add getNpmAlphaVersion(); alpha now validates and publishes like master - test-release-automation.js: 34 tests covering new flows end-to-end Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com>
Copilot
AI
changed the title
fix: correct release automation — no-op safety in create-release-pr and read-only master publish
feat: PR-based release flow for alpha; test suite proving all three release properties
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alpha published on every push with no human gate. Master had no automated tests proving the trigger conditions were correct. Both gaps are addressed here.
Flow change: alpha now mirrors master
alpha(touchespackages/**)alphanpm tagmasterlatesttagcreate-release-pr.ymlalphatoon.push.branchesX.Y.Z-alpha.N → X.Y.Z-alpha.(N+1)(or(major+1).0.0-alpha.1if no alpha suffix yet); master uses npm patch-incrementchore/alpha-release-vX, titlechore: alpha release vX,--base alphachore: alpha release vand/alpha-release-vadded toif:skip conditionpublish.ymlpush: branches: alphatrigger entirelyalphatopull_request.branches; updateif:to matchbase.ref == alpha && title starts with 'chore: alpha release v'ref:— always a PR event now, no push/PR ternary neededbump-and-publish.jsgetNpmAlphaVersion()vianpm view less dist-tags.alphapackage.json > npm dist-tags.alpha(same pattern as master vsnpm latest)Test suite (
scripts/test-release-automation.js, 34 tests,npm run test:release)Proves all three required properties without GitHub auth or npm credentials:
publish.ymlconditionscreate-release-pr.ymlconditions5.0.0-alpha.1 → 5.0.0-alpha.2, double-digit rollover, non-alpha seedbump-and-publishmaster pathbump-and-publishalpha path-alpha.suffix; publishes withalphatagghcalls when version unchangedOriginal prompt
Create a new pull request in
less/less.js(base branch:master) that fixes the release automation introduced in PR #4430 so that:Goal
Merges to
master(that are not merges of the release PR itself) should create or update a release branch/PR that bumps versions. When that release PR is merged, the publish workflow should publish to npm.This PR should focus only on correcting the scripts/workflows for this automation; do not refactor unrelated parts.
Background / context
PR #4430 (merged) introduced a PR-based release flow for
master:.github/workflows/create-release-pr.ymlthat runs on pushes tomaster(paths underpackages/**) and creates/updates achore: release vX.Y.ZPR with version bumps..github/workflows/publish.ymlthat publishes onalphadirect pushes and onmasterwhen a release PR is merged.scripts/bump-and-publish.jsused during publishing.Copilot PR review feedback in #4430 highlighted a key correctness issue in
create-release-pr.yml: when there are no staged changes (git diff --cached --quiet), the workflow still pushes and may attemptgh pr create, which fails with “no commits between head and base”. Fix this so the workflow exits early (or at least skips PR creation) when there’s no new commit to create for the release branch.Requirements / acceptance criteria
Create Release PR workflow works on normal merges to master
pushtomasteraffectingpackages/**, the workflow must either:chore/release-v<next_version>offorigin/master, commit version bumps, push the branch, and open a PR tomaster, ORNo infinite loop
No-op safety
Publish on release PR merge
.github/workflows/publish.ymltriggersnpm publishwhen (and only when) the release PR is merged intomaster.masterthat are not release merges.Keep
alphabehavior intactalphadirect-push publishing behavior should remain unchanged.Implementation notes
set -euo pipefailwhere appropriate.gh pr create,gh pr createif there are no commits.Deliverables
Relevant existing review note from #4430 to address:
.github/workflows/create-release-pr.yml, ifgit diff --cached --quietis true (no version changes), workflow still pushes and may attemptgh pr createand can fail with “no commits between head and base”. Fix by exiting early / skipping PR creation in that case.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: I can't get copilot to fix this -- read through the comments please and see where I was trying to get Copilot to resolve the issue: @less/less.js/pull/4430
Assistant: I pulled the review comment threads that exist on
less/less.js#4430and the commit list for the PR. What I can’t see from the data returned is the full “PR conversation” (top-level PR description discussion, your back-and-forth with Copilot SWE Agent, etc.). The tool output only included Copilot Pull Request Reviewer’s 3 inline comments plus the PR’s commit list.That said, those inline review threads make it pretty clear where you were trying to steer Copilot, and what remained incomplete.
What you were trying to get Copilot to resolve (and why)
Your core goal (as the PR title says) was:
The tricky part you were trying to force the automation to respect is:
master, you want a PR-based version bump (so the bump commit is merged intomasternormally).This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.