Skip to content

Commit a234385

Browse files
authored
Add a ready-to-merge check (#910)
Github allows setting a list of required status before merging into a protected branch (in our case, `master`). However, it requires the checks to have a fixed name (no pattern matching allowed). As some of our checks are dynamically generated using a testing matrix, the names may change. It is not convenient to set them as required status. This PR adds another check. It passes if all other checks pass (except ignored checks). We can use this new check as the required status for merging. Once we set up a proper required check, we can enable merge queue. This PR also adds a `merge_group` trigger for pre code review checks.
1 parent 63b900c commit a234385

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.github/workflows/merge-check.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Merge Check
2+
on:
3+
merge_group:
4+
branches:
5+
- master
6+
7+
jobs:
8+
ready-to-merge:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: 'Wait for status checks'
12+
id: waitforstatuschecks
13+
timeout-minutes: 120
14+
uses: "WyriHaximus/[email protected]"
15+
with:
16+
# Ignore some actions (based on what merge_group triggers):
17+
# - this action
18+
# - pre code review checks for stable Rust (we allow them to fail)
19+
ignoreActions: "ready-to-merge,pre-code-review-checks/x86_64-unknown-linux-gnu/stable,pre-code-review-checks/i686-unknown-linux-gnu/stable,pre-code-review-checks/x86_64-apple-darwin/stable"
20+
# This action uses API. We have a quota of 1000 per day.
21+
# We normally run tests within 1 hours (excluding binding tests).
22+
# If we check every 10 mins, we use roughly 6 API calls per trigger.
23+
# We can handle ~160 triggers.
24+
checkInterval: 600
25+
env:
26+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/pre-review-ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
branches:
66
- master
7+
merge_group:
8+
branches:
9+
- master
710

811
concurrency:
912
# Cancels pending runs when a PR gets updated.
@@ -36,7 +39,7 @@ jobs:
3639
- { os: macos-12, triple: x86_64-apple-darwin }
3740
rust: ${{ fromJson(needs.setup-test-matrix.outputs.rust )}}
3841

39-
name: ${{ matrix.target.triple }} / ${{ matrix.rust }}
42+
name: pre-code-review-checks/${{ matrix.target.triple }}/${{ matrix.rust }}
4043
runs-on: ${{ matrix.target.os }}
4144

4245
steps:

0 commit comments

Comments
 (0)