From 42877729ded2fec42a077b5d0751a7525c7c49e0 Mon Sep 17 00:00:00 2001
From: Quentin Monnet <qmo@qmon.net>
Date: Thu, 21 Nov 2024 23:31:41 +0000
Subject: [PATCH] ci: Run mergeability and cargo-fmt workflows in merge queue

The workflows are marked as required, which blocks the merge queue if we
don't run them. Let's trigger the workflows on "merge_group", too.

Signed-off-by: Quentin Monnet <qmo@qmon.net>
---
 .github/workflows/lint-cargo-fmt.yml | 5 +++++
 .github/workflows/mergeability.yml   | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/.github/workflows/lint-cargo-fmt.yml b/.github/workflows/lint-cargo-fmt.yml
index 6554baab..538451cc 100644
--- a/.github/workflows/lint-cargo-fmt.yml
+++ b/.github/workflows/lint-cargo-fmt.yml
@@ -4,6 +4,8 @@ name: "lint-cargo-fmt.yml"
 
 on:
   pull_request: {}
+  merge_group:
+    types: ["checks_requested"]
 
 concurrency:
   group: "${{ github.workflow }}:${{ github.event.pull_request.number }}"
@@ -13,6 +15,9 @@ jobs:
   format-check:
     name: "Check formatting for Rust code"
     runs-on: "ubuntu-latest"
+    # Skip this job in merge group checks; but we need the workflow to run,
+    # given that the status check is required for merging.
+    if: "${{ github.event.pull_request }}"
     steps:
       - name: "Install Rust toolchain"
         uses: "dtolnay/rust-toolchain@stable"
diff --git a/.github/workflows/mergeability.yml b/.github/workflows/mergeability.yml
index 17ee83d5..e90736ab 100644
--- a/.github/workflows/mergeability.yml
+++ b/.github/workflows/mergeability.yml
@@ -5,11 +5,16 @@ name: "mergeability.yml"
 on:
   pull_request:
     types: [synchronize, opened, reopened, labeled, unlabeled]
+  merge_group:
+    types: ["checks_requested"]
 
 jobs:
   check-labels:
     runs-on: "ubuntu-latest"
     name: "Check mergeability based on labels"
+    # Skip this job in merge group checks; but we need the workflow to run,
+    # given that the status check is required for merging.
+    if: "${{ github.event.pull_request }}"
     steps:
       - if: ${{ contains(github.event.*.labels.*.name, 'dont-merge') }}
         name: "Fail test due to 'dont-merge' label presence"