ci: Skip merge queue if pull request is up-to-date
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
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
- [ ] I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
[!NOTE] Adds a composite action and workflow gating to skip merge-queue jobs when the PR is up-to-date and first in queue.
- CI
- New composite action
./.github/actions/check-merge-queue/action.yml:
- Parses PR number from
head-ref, queries GraphQL forheadRefNameandmergeQueueEntry.position, and outputsup-to-date=truewhen base is ancestor and position is1.- Main workflow updates
./.github/workflows/main.yml:
- Adds
check-skip-merge-queuejob (onmerge_group) to setskip-merge-queueoutput.- Gates
check-workflows,analyse-code,lint-build-test, andcheck-releaseto run only when not skipping.- Updates
needsacross jobs to includecheck-skip-merge-queueand adjustsall-jobs-passto pass when either all jobs succeed or skip is enabled.Written by Cursor Bugbot for commit db0df85bd4cc523dd852afac4aee19ee747f54c9. This will update automatically on new commits. Configure here.