Skip to content

ci: add changeset merge guard for merge queue#7440

Merged
alexprudhomme merged 4 commits intomainfrom
changeset-pr-merge-queue
Apr 16, 2026
Merged

ci: add changeset merge guard for merge queue#7440
alexprudhomme merged 4 commits intomainfrom
changeset-pr-merge-queue

Conversation

@alexprudhomme
Copy link
Copy Markdown
Contributor

@alexprudhomme alexprudhomme commented Apr 15, 2026

https://coveord.atlassian.net/browse/KIT-5622

Changeset merge guard

Adds a changeset-merge-guard job to the existing CI workflow (ci.yml) that prevents stale version PRs from being merged through the merge queue.

Problem

When a version PR (ci(changesets): version packages) and a changeset-adding PR enter the merge queue in the same batch, they can merge together. The CD then finds unprocessed changesets and enters "create PR" mode instead of publishing — delaying the release by one cycle.

Solution

A new changeset-merge-guard job in ci.yml (which already triggers on merge_group) that:

  1. Scans commits in the merge group for version PR pattern
  2. If found, checks for any unprocessed .changeset/*.md files
  3. Fails the batch if both are present → GitHub bisects → they merge separately

The job is wired into is-valid-merge-queue so failures propagate to Confirm build is valid.

Behavior matrix

Batch Version PR? Changesets remain? Check Outcome
A only No No ✅ Pass No publish
B only Yes No ✅ Pass Publishes ✅
C only No Yes ✅ Pass Creates version PR
A + B Yes No ✅ Pass Publishes ✅
A + C No Yes ✅ Pass Creates version PR
B + C Yes Yes ❌ Fail Bisects → B publishes, C creates version PR
A + B + C Yes Yes ❌ Fail Bisects → A+B publish, C creates version PR

All 13 scenarios (including edge cases) tested locally with act.

Prerequisites

Merge queue must be enabled on main for the merge_group trigger to fire.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2026

⚠️ No Changeset found

Latest commit: 2b88a7e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@svcsnykcoveo
Copy link
Copy Markdown

svcsnykcoveo commented Apr 15, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the resilience of the CD workflow when the Changesets “Version Packages” branch is blocked by GitHub’s merge queue, preventing the workflow from failing in that scenario.

Changes:

  • Add continue-on-error: true to the changesets/action step in the CD workflow.

Comment thread .github/workflows/cd.yml Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 15, 2026

Open in StackBlitz

@coveo/atomic

npm i https://pkg.pr.new/@coveo/atomic@7440

@coveo/atomic-hosted-page

npm i https://pkg.pr.new/@coveo/atomic-hosted-page@7440

@coveo/atomic-legacy

npm i https://pkg.pr.new/@coveo/atomic-legacy@7440

@coveo/atomic-react

npm i https://pkg.pr.new/@coveo/atomic-react@7440

@coveo/auth

npm i https://pkg.pr.new/@coveo/auth@7440

@coveo/bueno

npm i https://pkg.pr.new/@coveo/bueno@7440

@coveo/create-atomic

npm i https://pkg.pr.new/@coveo/create-atomic@7440

@coveo/create-atomic-component

npm i https://pkg.pr.new/@coveo/create-atomic-component@7440

@coveo/create-atomic-component-project

npm i https://pkg.pr.new/@coveo/create-atomic-component-project@7440

@coveo/create-atomic-result-component

npm i https://pkg.pr.new/@coveo/create-atomic-result-component@7440

@coveo/create-atomic-rollup-plugin

npm i https://pkg.pr.new/@coveo/create-atomic-rollup-plugin@7440

@coveo/headless

npm i https://pkg.pr.new/@coveo/headless@7440

@coveo/headless-react

npm i https://pkg.pr.new/@coveo/headless-react@7440

@coveo/shopify

npm i https://pkg.pr.new/@coveo/shopify@7440

commit: 2b88a7e

@alexprudhomme alexprudhomme marked this pull request as draft April 15, 2026 14:43
Adds a workflow that prevents a race condition where a changeset
version PR is batched in the merge queue with a PR that adds new
changesets. Without this guard, the version PR merges without
accounting for the new changesets, causing the CD to create another
version PR instead of publishing.

The check detects if a version PR commit is in the merge group and
fails if unprocessed changeset files remain.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@alexprudhomme alexprudhomme force-pushed the changeset-pr-merge-queue branch from e5951da to 02e2c3f Compare April 15, 2026 15:46
@alexprudhomme alexprudhomme changed the title fix(ci): add continue-on-error to changesets step for merge queue resilience ci: add changeset merge guard for merge queue Apr 15, 2026
Move the changeset-merge-guard job from a standalone workflow into
ci.yml where it already has merge_group trigger. This eliminates a
separate workflow file and means the check is automatically included
in the existing CI required status checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add changeset-merge-guard to the is-valid-merge-queue needs list so
that a guard failure propagates to 'Confirm build is valid' and
actually blocks the merge queue batch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread .github/workflows/ci.yml Outdated
Move inline shell script from ci.yml into a reusable composite action
at .github/actions/changeset-merge-guard/ as requested in PR review.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@alexprudhomme alexprudhomme enabled auto-merge April 16, 2026 13:24
@alexprudhomme alexprudhomme added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit 252e8f8 Apr 16, 2026
51 checks passed
@alexprudhomme alexprudhomme deleted the changeset-pr-merge-queue branch April 16, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants