From efb8d0f823ed28d20500dc5ead277984a57f86ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= <berykubik@gmail.com>
Date: Mon, 21 Oct 2024 13:00:36 +0200
Subject: [PATCH] Configure CI for merge queue

To remove bors, which is not really needed for this repo.
---
 .github/workflows/ci.yml | 33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2895042ce7d..d54cae9c214 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,13 +1,7 @@
 name: CI
 on:
-  push:
-    branches:
-      - master
-      - auto
-      - try
+  merge_group:
   pull_request:
-    branches:
-      - "**"
 
 jobs:
   test:
@@ -111,22 +105,15 @@ jobs:
       - name: Build Chalk book
         run: cd book && ./mdbook build
 
-  end-success:
-    name: bors build finished
-    if: success()
-    runs-on: ubuntu-latest
+  conclusion:
     needs: [test, fmt]
-
-    steps:
-      - name: Mark the job as successful
-        run: exit 0
-
-  end-failure:
-    name: bors build finished
-    if: "!success()"
+    # !cancelled() executes the job regardless of whether the previous jobs passed, failed or get skipped.
+    if: ${{ !cancelled() }}
     runs-on: ubuntu-latest
-    needs: [test, fmt]
-
     steps:
-      - name: Mark the job as a failure
-        run: exit 1
+      - name: Conclusion
+        run: |
+          # Print the dependent jobs to see them in the CI log
+          jq -C <<< '${{ toJson(needs) }}'
+          # Check if all jobs that we depend on (in the needs array) were successful.
+          jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'