Skip to content

ci: don't run push CI on merge-queue branches - #12633

Merged
zkochan merged 1 commit into
mainfrom
fix/merge-queue-duplicate-push-runs
Jun 24, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix/merge-queue-duplicate-push-runs

Conversation

@zkochan

@zkochan zkochan commented Jun 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes the merge queue ejecting PRs for "failed status checks" (e.g. this run).

GitHub's merge queue runs each entry on a temporary gh-readonly-queue/** branch, whose creation also fires a push event. Because ci.yml listens on [push, pull_request, merge_group], this produced two TS CI runs for the identical commit — one push, one merge_group:

28100166958  push         success     gh-readonly-queue/main/pr-12630-ebd38f8...
28100166658  merge_group  cancelled   gh-readonly-queue/main/pr-12630-ebd38f8...  ← same SHA

Both runs reach the reusable test.yml, whose concurrency group keys on github.ref with cancel-in-progress: true. Since the two runs share github.ref, each per-(platform, node, chunk) test job lands in the same group, so the later one cancels the earlier:

Canceling since a higher priority waiting request for TS CI-refs/heads/gh-readonly-queue/main/pr-12630-…-windows-latest-22.13.0-2-3 exists

The Windows shards are gated only on compile-and-lint + build-pnpr, so both runs' Windows jobs start near-simultaneously and reliably collide (the ubuntu jobs wait on test-smoke, which staggers them apart). The merge_group run — the only one the queue's required TS CI / Success check reads — lost the race, so its cancelled test jobs failed Success and the PR was ejected.

TS CI / Success is not the culprit: it needs: every test job, so it waits for them and only reports the cancellation afterward.

Fix

Restrict the push trigger in ci.yml to ignore gh-readonly-queue/**, so only the merge_group run executes for queued commits (that run already forces the full suite and is the only run the queue reads, so dropping the push duplicate is pure upside). pacquet-ci.yml already scopes push to branches: [main] and was unaffected. The same branches-ignore is applied to audit.yml to drop its redundant (non-breaking, just wasteful) push run on those branches.

Squash Commit Body

GitHub's merge queue runs each entry on a temporary gh-readonly-queue/**
branch, whose creation also fires a push event. For ci.yml
(on: [push, pull_request, merge_group]) that produced two TS CI runs for
the identical commit: one push, one merge_group. Both reach the reusable
test.yml, whose concurrency group keys on github.ref with
cancel-in-progress: true, so their per-(platform, node, chunk) test jobs
land in the same group and cancel each other. The merge_group run — the
only one the queue's required TS CI / Success check reads — lost the
race, failing Success and ejecting the PR.

Restrict the push trigger to ignore gh-readonly-queue/** so only the
merge_group run executes for queued commits. pacquet-ci.yml already
scopes push to main and was unaffected. Apply the same branches-ignore
to audit.yml to drop its redundant push run on those branches.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pacquet/ port, or the description notes what still needs porting. (CI-only; not user-visible CLI surface — no pacquet port needed.)
  • Added a changeset (pnpm changeset) if this PR changes any published package. (No published package changes — CI workflow only.)
  • Added or updated tests. (Not applicable to workflow trigger config.)
  • Updated the documentation if needed. (Not applicable.)

Written by an agent (Claude Code, claude-opus-4-8).

Summary by CodeRabbit

  • Chores
    • Updated automation workflow triggers to use explicit event definitions instead of shorthand configuration.
    • Reduced duplicate runs by excluding temporary merge-queue branches from push-triggered workflows.
    • Kept pull request and merge-queue checks active, with no changes to the actual audit or CI job steps/logic.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: eb833004-ca9a-4cbe-b75b-030046a5bf66

📥 Commits

Reviewing files that changed from the base of the PR and between f9aa0b3 and 01d725d.

📒 Files selected for processing (2)
  • .github/workflows/audit.yml
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

Two GitHub Actions workflows expand shorthand on: triggers into explicit event mappings. Both add a branches-ignore filter for gh-readonly-queue/** on push; ci.yml also keeps merge_group.

Changes

Workflow Trigger Deduplication

Layer / File(s) Summary
Explicit push filters in audit and CI workflows
.github/workflows/audit.yml, .github/workflows/ci.yml
Both workflows replace shorthand trigger arrays with explicit event blocks. push excludes gh-readonly-queue/**, while ci.yml also includes merge_group as a separate event key.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • pnpm/pnpm#12627: Also changes .github/workflows/ci.yml around merge-queue trigger behavior and duplicate run avoidance.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/merge-queue-duplicate-push-runs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

GitHub's merge queue runs each entry on a temporary
`gh-readonly-queue/**` branch, whose creation also fires a `push`
event. For `ci.yml` (`on: [push, pull_request, merge_group]`) that
produced two TS CI runs for the identical commit: one `push`, one
`merge_group`. Both reach the reusable `test.yml`, whose concurrency
group keys on `github.ref` with `cancel-in-progress: true`. Since the
two runs share `github.ref`, their per-(platform, node, chunk) test
jobs land in the same group and cancel each other.

The Windows shards are gated only on compile-and-lint + build-pnpr, so
both runs' Windows jobs start near-simultaneously and reliably collide.
The `merge_group` run — the only one the queue's required
`TS CI / Success` check reads — lost the race, so its cancelled test
jobs failed `Success` and ejected the PR for "failed status checks".

Restrict the `push` trigger to ignore `gh-readonly-queue/**` so only
the `merge_group` run executes for queued commits. `pacquet-ci.yml`
already scopes push to `main` and was unaffected. Apply the same
`branches-ignore` to `audit.yml` to drop its redundant push run on
those branches.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

CI: skip push-triggered workflows on merge queue gh-readonly-queue branches
⚙️ Configuration changes 🕐 Less than 10 minutes

Grey Divider

Description

• Prevent duplicate CI runs for merge-queue commits by ignoring gh-readonly-queue/** push events.
• Avoid test job cancellations caused by shared concurrency groups between push and merge_group
 runs.
• Reduce wasted Audit workflow runs on merge-queue temporary branches.
Diagram

graph TD
  MQ{{"GitHub Merge Queue"}} --> REF["gh-readonly-queue/** branch"] --> EVT["Events: push + merge_group"] --> CI["TS CI (ci.yml)"] --> IGN["push branches-ignore"] --> ONLY["Only merge_group runs"]
  REF --> AUD["Audit (audit.yml)"] --> AIGN["push branches-ignore"] --> AONLY["PR run only"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Change concurrency group key to include event type
  • ➕ Allows both push and merge_group runs to coexist without canceling each other
  • ➕ Keeps push CI coverage for merge-queue branches if desired for debugging
  • ➖ Still wastes CI capacity by running duplicate workflows for the same SHA
  • ➖ Higher risk of subtle concurrency regressions across reusable workflows/jobs
2. Restrict push triggers to explicit branches (e.g., main only)
  • ➕ Simple rule; avoids most duplicate branch-driven CI runs
  • ➕ Reduces CI load beyond just merge-queue branches
  • ➖ Changes current behavior for other branches where push CI may be intentionally relied on
  • ➖ May require follow-up to preserve expected coverage for release/hotfix branches
3. Disable cancel-in-progress for merge_group runs
  • ➕ Avoids cancellations causing required check failures
  • ➕ Keeps both runs if redundancy is desired
  • ➖ Allows duplicate runs to fully execute, increasing CI load
  • ➖ Doesn’t address the root cause (two workflows for same ref/SHA)

Recommendation: The chosen approach (ignore push events on gh-readonly-queue/**) is the best tradeoff: it removes the redundant run at the source, prevents concurrency collisions, and aligns with the merge queue’s required-check semantics (merge_group is the authoritative run). The alternatives either keep redundant work or broaden behavioral changes beyond the merge-queue scenario.

Files changed (2) +20 / -2

Other (2) +20 / -2
audit.ymlIgnore merge-queue push events for Audit workflow +7/-1

Ignore merge-queue push events for Audit workflow

• Replaces the shorthand on: [push, pull_request] with explicit triggers. Adds push.branches-ignore for gh-readonly-queue/** so the merge queue’s temporary branch doesn’t cause a redundant Audit run.

.github/workflows/audit.yml

ci.ymlIgnore merge-queue push events to prevent duplicate TS CI runs +13/-1

Ignore merge-queue push events to prevent duplicate TS CI runs

• Expands the workflow triggers to explicitly configure push with branches-ignore: gh-readonly-queue/**. Includes documentation explaining the merge queue duplicate-run/concurrency-cancellation failure mode, ensuring only merge_group runs execute for queued commits.

.github/workflows/ci.yml

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jun 24, 2026
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Merge-queue audit removed 🐞 Bug ⛨ Security
Description
audit.yml now ignores push events on gh-readonly-queue/** but does not trigger on merge_group,
so merge-queue commits will run with no dependency audit at all. This reduces pre-merge security
coverage for the merged result (especially when multiple queued PRs combine into a different
lockfile state than any single PR run).
Code

.github/workflows/audit.yml[R3-9]

+on:
+  push:
+    # Skip the redundant run on the merge queue's temporary
+    # `gh-readonly-queue/**` branches; the pull_request run already covered it.
+    branches-ignore:
+      - 'gh-readonly-queue/**'
+  pull_request:
Evidence
audit.yml now ignores pushes to gh-readonly-queue/** and only runs on push/pull_request, so
it will not execute for merge-queue commits which run under merge_group. Other CI workflows
explicitly include merge_group, confirming this is the merge-queue execution path in this repo.

.github/workflows/audit.yml[1-10]
.github/workflows/ci.yml[1-16]
.github/workflows/pacquet-ci.yml[14-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`Audit` no longer runs for merge-queue commits because `push` is ignored on `gh-readonly-queue/**` branches and the workflow does not listen to `merge_group`.
### Issue Context
The merge queue executes required checks on temporary `gh-readonly-queue/**` refs via the `merge_group` event. With the current triggers, `Audit dependencies` will not run on those merge-queue commits.
### Fix Focus Areas
- .github/workflows/audit.yml[1-10]
### Suggested change
- Add `merge_group:` under `on:` in `audit.yml` (keep `push.branches-ignore` if you still want to prevent the redundant `push` run on merge-queue branches).
- Optionally update the comment to reflect that `pull_request` does **not** cover the merged merge-queue result; `merge_group` would.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. TS CI branch-name bypass 🐞 Bug ⛨ Security
Description
ci.yml now ignores push events for gh-readonly-queue/**, but TS CI jobs are designed to skip
same-repo pull_request runs (relying on push instead). A PR opened from a branch named
gh-readonly-queue/** would therefore skip all TS CI work while TS CI / Success can still pass
because it only fails on failure/cancelled, not skipped.
Code

.github/workflows/ci.yml[R3-15]

+on:
+  push:
+    # The merge queue runs each entry on a temporary `gh-readonly-queue/**`
+    # branch, whose creation also fires a `push` event. That duplicate run
+    # shares `github.ref` (hence the test.yml concurrency group) with the
+    # `merge_group` run for the same commit, so with `cancel-in-progress`
+    # the two cancel each other's test jobs — failing `TS CI / Success` and
+    # ejecting the PR. Only the `merge_group` run reports to the queue, so
+    # skip `push` for those branches.
+    branches-ignore:
+      - 'gh-readonly-queue/**'
+  pull_request:
+  merge_group:
Evidence
The new push.branches-ignore disables the push run for gh-readonly-queue/**, while key jobs’
if: expressions explicitly skip same-repo pull_request events (they only run for push,
merge_group, forks, or a special automation branch). The aggregate TS CI / Success job fails
only on failure/cancelled, so a workflow where dependencies are skipped still reports success.

.github/workflows/ci.yml[3-15]
.github/workflows/ci.yml[65-107]
.github/workflows/ci.yml[243-265]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`ci.yml` ignores `push` events for `gh-readonly-queue/**` branches, but several jobs skip same-repo `pull_request` events under the assumption that a `push` run exists. This creates a path where a same-repo PR from a `gh-readonly-queue/**`-prefixed branch can end up with `TS CI / Success` reporting green while all substantive jobs were skipped.
### Issue Context
This is an edge case but it weakens the signal of the required `TS CI / Success` check for any PR branch that matches the ignored prefix.
### Fix Focus Areas
- .github/workflows/ci.yml[3-15]
- .github/workflows/ci.yml[65-107]
- .github/workflows/ci.yml[243-265]
### Suggested fix approach
- Adjust the job-level `if:` conditions (e.g., `compile-and-lint`, `build-pnpr`, and any other jobs with the same skip logic) to *not* skip `pull_request` runs when `github.head_ref` matches the ignored prefix, e.g. add an allowance like `|| startsWith(github.head_ref, 'gh-readonly-queue/')`.
- Alternatively (more defensive), change the `success` gate to fail when `needs.changes.outputs.ts == 'true'` but all major jobs were `skipped` (so required checks can’t be satisfied by an all-skipped run).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Previous review results

Review updated until commit 01d725d

Results up to commit 01d725d


🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Merge-queue audit removed 🐞 Bug ⛨ Security ⭐ New
Description
audit.yml now ignores push events on gh-readonly-queue/** but does not trigger on merge_group,
so merge-queue commits will run with no dependency audit at all. This reduces pre-merge security
coverage for the merged result (especially when multiple queued PRs combine into a different
lockfile state than any single PR run).
Code

.github/workflows/audit.yml[R3-9]

+on:
+  push:
+    # Skip the redundant run on the merge queue's temporary
+    # `gh-readonly-queue/**` branches; the pull_request run already covered it.
+    branches-ignore:
+      - 'gh-readonly-queue/**'
+  pull_request:
Evidence
audit.yml now ignores pushes to gh-readonly-queue/** and only runs on push/pull_request, so
it will not execute for merge-queue commits which run under merge_group. Other CI workflows
explicitly include merge_group, confirming this is the merge-queue execution path in this repo.

.github/workflows/audit.yml[1-10]
.github/workflows/ci.yml[1-16]
.github/workflows/pacquet-ci.yml[14-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`Audit` no longer runs for merge-queue commits because `push` is ignored on `gh-readonly-queue/**` branches and the workflow does not listen to `merge_group`.

### Issue Context
The merge queue executes required checks on temporary `gh-readonly-queue/**` refs via the `merge_group` event. With the current triggers, `Audit dependencies` will not run on those merge-queue commits.

### Fix Focus Areas
- .github/workflows/audit.yml[1-10]

### Suggested change
- Add `merge_group:` under `on:` in `audit.yml` (keep `push.branches-ignore` if you still want to prevent the redundant `push` run on merge-queue branches).
- Optionally update the comment to reflect that `pull_request` does **not** cover the merged merge-queue result; `merge_group` would.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. TS CI branch-name bypass 🐞 Bug ⛨ Security
Description
ci.yml now ignores push events for gh-readonly-queue/**, but TS CI jobs are designed to skip
same-repo pull_request runs (relying on push instead). A PR opened from a branch named
gh-readonly-queue/** would therefore skip all TS CI work while TS CI / Success can still pass
because it only fails on failure/cancelled, not skipped.
Code

.github/workflows/ci.yml[R3-15]

+on:
+  push:
+    # The merge queue runs each entry on a temporary `gh-readonly-queue/**`
+    # branch, whose creation also fires a `push` event. That duplicate run
+    # shares `github.ref` (hence the test.yml concurrency group) with the
+    # `merge_group` run for the same commit, so with `cancel-in-progress`
+    # the two cancel each other's test jobs — failing `TS CI / Success` and
+    # ejecting the PR. Only the `merge_group` run reports to the queue, so
+    # skip `push` for those branches.
+    branches-ignore:
+      - 'gh-readonly-queue/**'
+  pull_request:
+  merge_group:
Evidence
The new push.branches-ignore disables the push run for gh-readonly-queue/**, while key jobs’
if: expressions explicitly skip same-repo pull_request events (they only run for push,
merge_group, forks, or a special automation branch). The aggregate TS CI / Success job fails
only on failure/cancelled, so a workflow where dependencies are skipped still reports success.

.github/workflows/ci.yml[3-15]
.github/workflows/ci.yml[65-107]
.github/workflows/ci.yml[243-265]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`ci.yml` ignores `push` events for `gh-readonly-queue/**` branches, but several jobs skip same-repo `pull_request` events under the assumption that a `push` run exists. This creates a path where a same-repo PR from a `gh-readonly-queue/**`-prefixed branch can end up with `TS CI / Success` reporting green while all substantive jobs were skipped.
### Issue Context
This is an edge case but it weakens the signal of the required `TS CI / Success` check for any PR branch that matches the ignored prefix.
### Fix Focus Areas
- .github/workflows/ci.yml[3-15]
- .github/workflows/ci.yml[65-107]
- .github/workflows/ci.yml[243-265]
### Suggested fix approach
- Adjust the job-level `if:` conditions (e.g., `compile-and-lint`, `build-pnpr`, and any other jobs with the same skip logic) to *not* skip `pull_request` runs when `github.head_ref` matches the ignored prefix, e.g. add an allowance like `|| startsWith(github.head_ref, 'gh-readonly-queue/')`.
- Alternatively (more defensive), change the `success` gate to fail when `needs.changes.outputs.ts == 'true'` but all major jobs were `skipped` (so required checks can’t be satisfied by an all-skipped run).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit f9aa0b3


🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. TS CI branch-name bypass 🐞 Bug ⛨ Security
Description
ci.yml now ignores push events for gh-readonly-queue/**, but TS CI jobs are designed to skip
same-repo pull_request runs (relying on push instead). A PR opened from a branch named
gh-readonly-queue/** would therefore skip all TS CI work while TS CI / Success can still pass
because it only fails on failure/cancelled, not skipped.
Code

.github/workflows/ci.yml[R3-15]

+on:
+  push:
+    # The merge queue runs each entry on a temporary `gh-readonly-queue/**`
+    # branch, whose creation also fires a `push` event. That duplicate run
+    # shares `github.ref` (hence the test.yml concurrency group) with the
+    # `merge_group` run for the same commit, so with `cancel-in-progress`
+    # the two cancel each other's test jobs — failing `TS CI / Success` and
+    # ejecting the PR. Only the `merge_group` run reports to the queue, so
+    # skip `push` for those branches.
+    branches-ignore:
+      - 'gh-readonly-queue/**'
+  pull_request:
+  merge_group:
Evidence
The new push.branches-ignore disables the push run for gh-readonly-queue/**, while key jobs’
if: expressions explicitly skip same-repo pull_request events (they only run for push,
merge_group, forks, or a special automation branch). The aggregate TS CI / Success job fails
only on failure/cancelled, so a workflow where dependencies are skipped still reports success.

.github/workflows/ci.yml[3-15]
.github/workflows/ci.yml[65-107]
.github/workflows/ci.yml[243-265]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`ci.yml` ignores `push` events for `gh-readonly-queue/**` branches, but several jobs skip same-repo `pull_request` events under the assumption that a `push` run exists. This creates a path where a same-repo PR from a `gh-readonly-queue/**`-prefixed branch can end up with `TS CI / Success` reporting green while all substantive jobs were skipped.

### Issue Context
This is an edge case but it weakens the signal of the required `TS CI / Success` check for any PR branch that matches the ignored prefix.

### Fix Focus Areas
- .github/workflows/ci.yml[3-15]
- .github/workflows/ci.yml[65-107]
- .github/workflows/ci.yml[243-265]

### Suggested fix approach
- Adjust the job-level `if:` conditions (e.g., `compile-and-lint`, `build-pnpr`, and any other jobs with the same skip logic) to *not* skip `pull_request` runs when `github.head_ref` matches the ignored prefix, e.g. add an allowance like `|| startsWith(github.head_ref, 'gh-readonly-queue/')`.
- Alternatively (more defensive), change the `success` gate to fail when `needs.changes.outputs.ts == 'true'` but all major jobs were `skipped` (so required checks can’t be satisfied by an all-skipped run).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider

New Review Started

This review has been superseded by a new analysis

Grey Divider

Qodo Logo

@zkochan
zkochan force-pushed the fix/merge-queue-duplicate-push-runs branch from f9aa0b3 to 01d725d Compare June 24, 2026 13:27
@zkochan
zkochan merged commit e3f2be0 into main Jun 24, 2026
26 of 27 checks passed
@zkochan
zkochan deleted the fix/merge-queue-duplicate-push-runs branch June 24, 2026 13:28
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 01d725d

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 01d725d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant