Commit 4616964
authored
ci: Skip merge queue if pull request is up-to-date (#7514)
## Explanation
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.
To accomplish this, I've added an output to the action (`up-to-date`)
which we can use in all steps in the main workflow to determine if they
should run. If `up-to-date` is `true`, all jobs except `all-jobs-pass`
will be skipped, and the pull request will be merged much quicker.
## References
<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?
For example:
* Fixes #12345
* Related to #67890
-->
WPC-184
## Checklist
- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds a composite action to detect up-to-date PRs in the merge queue
and gates workflow jobs to skip queue checks when eligible.
>
> - **CI**:
> - **New composite action** `/.github/actions/check-merge-queue`:
> - Extracts PR number from `head-ref`, queries GraphQL for
`headRefName` and `mergeQueueEntry.position`, and outputs `up-to-date`
when branch is based on latest `base-ref` and queue position is `1`.
> - **Workflow updates** `/.github/workflows/main.yml`:
> - Adds `check-skip-merge-queue` job (merge_group only) exposing
`skip-merge-queue`.
> - Gates `check-workflows` with conditional `needs`/`if` to skip when
`skip-merge-queue` is `true`.
> - Updates `all-jobs-pass` to depend on `check-skip-merge-queue` and
succeed if either all jobs passed or skipping is allowed via `PASSED`
env.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ceccfa8. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 9700a18 commit 4616964
File tree
2 files changed
+118
-3
lines changed- .github
- actions/check-merge-queue
- workflows
2 files changed
+118
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
14 | 32 | | |
15 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
16 | 37 | | |
17 | 38 | | |
18 | 39 | | |
| |||
127 | 148 | | |
128 | 149 | | |
129 | 150 | | |
130 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
131 | 156 | | |
132 | 157 | | |
133 | 158 | | |
134 | | - | |
135 | | - | |
| 159 | + | |
136 | 160 | | |
137 | 161 | | |
0 commit comments