Skip to content

ci: Skip merge queue if pull request is up-to-date#24786

Merged
Mrtenz merged 3 commits into
mainfrom
mrtenz/skip-merge-queue
Mar 30, 2026
Merged

ci: Skip merge queue if pull request is up-to-date#24786
Mrtenz merged 3 commits into
mainfrom
mrtenz/skip-merge-queue

Conversation

@Mrtenz

@Mrtenz Mrtenz commented Jan 16, 2026

Copy link
Copy Markdown
Member

Description

This adds a new action which determines whether a pull request in the merge queue is up-to-date, meaning:

  • The pull request is based on the latest commit on main.
  • The pull request is the first in the merge queue.

In this case, all status checks have already passed on the branch, and running in the merge queue would be redundant, meaning we can skip the merge queue checks.

The same thing was implemented in the extension here: MetaMask/metamask-extension#38966

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes CI behavior for merge_group events by conditionally skipping most checks, which could let an incorrect “up-to-date” determination bypass required validations if the action/logic is wrong.

Overview
Adds a new check-skip-merge-queue job to detect when a PR in the merge queue is already up-to-date (and first in queue) via MetaMask/github-tools.

When that flag is true, most CI jobs (lint/test/dedupe/workflow checks/bundle size and smart E2E selection) are skipped during merge_group runs, and check-all-jobs-pass treats the workflow as passed to avoid redundant merge-queue executions.

Written by Cursor Bugbot for commit e04991a. This will update automatically on new commits. Configure here.

@metamaskbot metamaskbot added the team-core-platform Core Platform team label Jan 16, 2026
Comment thread .github/workflows/ci.yml
uses: MetaMask/github-tools/.github/actions/check-skip-merge-queue@v1

check-diff:
name: Check diff

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also added some missing names in this PR for consistency. Can move this into a separate pull request if preferred.

@Mrtenz Mrtenz force-pushed the mrtenz/skip-merge-queue branch from bafa24f to e8c82d9 Compare January 22, 2026 12:04
@Mrtenz Mrtenz marked this pull request as ready for review January 26, 2026 11:53
@Mrtenz Mrtenz requested a review from a team as a code owner January 26, 2026 11:53
@Mrtenz Mrtenz added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Jan 26, 2026
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
dedupe:
name: Dedupe
runs-on: ubuntu-latest
if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just to make sure I'm not missing anything. There is no risk of removing dedupe from the merge queue? I'm not remembering anything, just thinking out loud

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is not removing it from the merge queue. With this condition, dedupe will run if:

  • The run is not in the merge queue (pull_request, push); or
  • The run is in the merge queue, but skip-merge-queue is not true.

I don't think we can safely remove dedupe from the merge queue in pull requests that are not up-to-date.

tommasini
tommasini previously approved these changes Jan 26, 2026

@tommasini tommasini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is very cool! LGTM!

@Mrtenz Mrtenz force-pushed the mrtenz/skip-merge-queue branch from c5d9929 to 70fec24 Compare January 26, 2026 12:49
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
tommasini
tommasini previously approved these changes Jan 26, 2026
@Mrtenz Mrtenz force-pushed the mrtenz/skip-merge-queue branch 2 times, most recently from 7f12895 to 560ada5 Compare January 26, 2026 14:43
@Mrtenz Mrtenz added skip-e2e skip E2E test jobs and removed skip-e2e skip E2E test jobs labels Jan 26, 2026
NicolasMassart
NicolasMassart previously approved these changes Jan 26, 2026

@NicolasMassart NicolasMassart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, a few suggestions to make this easier to understand and ideall if you cold add a few comment on the process ?

Comment thread .github/workflows/ci.yml
name: Check if pull request can skip merge queue
runs-on: ubuntu-latest
outputs:
skip-merge-queue: ${{ steps.check-skip-merge-queue.outputs.up-to-date }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

S: The mapping is correct, but the naming is confusing. Consider renaming for clarity or document the mapping.

@Mrtenz Mrtenz force-pushed the mrtenz/skip-merge-queue branch 6 times, most recently from acffdfc to 20e7789 Compare January 27, 2026 11:15
@Mrtenz Mrtenz added this pull request to the merge queue Jan 27, 2026
@Mrtenz Mrtenz removed this pull request from the merge queue due to a manual request Jan 27, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Jan 27, 2026
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This adds a new action which determines whether a pull request in the
merge queue is up-to-date, meaning:

- The pull request is based on the latest commit on `main`.
- The pull request is the first in the merge queue.

In this case, all status checks have already passed on the branch, and
running in the merge queue would be redundant, meaning we can skip the
merge queue checks.

The same thing was implemented in the extension here:
MetaMask/metamask-extension#38966

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Introduces a merge-queue optimization to skip CI when a PR in
`merge_group` is already up-to-date and first in queue.
> 
> - Adds `check-skip-merge-queue` job (uses `MetaMask/github-tools`
action) to detect up-to-date PRs
> - Gates most jobs (`check-diff`, `dedupe`, `git-safe-dependencies`,
`scripts`, `unit-tests`, `merge-unit-tests`, `needs_e2e_build`,
`component-view-test`, `smart-e2e-selection`, `js-bundle-size-check`,
`sonar-cloud`, `sonar-cloud-quality-gate-status`, `check-workflows`)
with `if: github.event_name != 'merge_group' ||
needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'` and
adds `needs: [check-skip-merge-queue]`
> - Updates `merge-unit-tests`/`sonar-cloud` dependencies and conditions
to respect skip logic; `check-all-jobs-pass` short-circuits when
`SKIPPED` is true
> - Adds human-friendly `name:` labels across jobs; no application code
changes
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
20e7789. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@Mrtenz Mrtenz force-pushed the mrtenz/skip-merge-queue branch from 20e7789 to dd033c3 Compare January 27, 2026 22:43
Comment thread .github/workflows/ci.yml
@sonarqubecloud

Copy link
Copy Markdown

@Mrtenz Mrtenz dismissed stale reviews from NicolasMassart and tommasini via a2116f1 March 27, 2026 12:05
@Mrtenz Mrtenz force-pushed the mrtenz/skip-merge-queue branch from dd033c3 to a2116f1 Compare March 27, 2026 12:05
@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Mar 27, 2026
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Mar 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 95%
click to see 🤖 AI reasoning details

E2E Test Selection:
The only changed file is .github/workflows/ci.yml, which contains purely CI/CD infrastructure changes:

  1. New check-skip-merge-queue job: Adds a job that checks if a PR can skip the merge queue using MetaMask/github-tools/.github/actions/check-skip-merge-queue@v1. This is a merge queue optimization.

  2. Conditional execution guards: Adds if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true' to all CI jobs, allowing them to be bypassed when a PR is already up-to-date with the target branch.

  3. Dependency chain updates: All jobs now depend on check-skip-merge-queue to receive the skip status output.

  4. all-e2e-pass job update: Adds early-exit logic when merge queue is skipped.

  5. Job name additions: Adds human-readable name: fields to several jobs for better UI display.

These changes are entirely about CI pipeline optimization (merge queue skip logic) and do not touch:

  • Any application source code
  • Any test files or test infrastructure
  • Any E2E test configuration
  • Any component, controller, or service code

No E2E tests need to run for this change. The risk is low as this only affects CI orchestration logic, not the app itself.

Performance Test Selection:
No application code, rendering logic, state management, or performance-sensitive paths were changed. This is a pure CI workflow change with no impact on app performance.

View GitHub Actions results

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread .github/workflows/ci.yml
@sonarqubecloud

Copy link
Copy Markdown

@Mrtenz Mrtenz added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit 3b3279d Mar 30, 2026
63 checks passed
@Mrtenz Mrtenz deleted the mrtenz/skip-merge-queue branch March 30, 2026 11:08
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 30, 2026
@metamaskbot metamaskbot added the release-7.73.0 Issue or pull request that will be included in release 7.73.0 label Mar 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-low Low testing needed · Low bug introduction risk size-S team-core-platform Core Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants