From e61a3c923836dbc23fd9e006a7d97468441e3d68 Mon Sep 17 00:00:00 2001
From: Bryan Richter <bryan@haskell.foundation>
Date: Tue, 11 Oct 2022 15:04:01 +0300
Subject: [PATCH] Prevent duplicate merge request pipelines

---
 .gitlab-ci.yml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3e78fd68..62cb1466 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,6 +15,15 @@
 # can trigger a multi-project pipeline, specifying a GHC binary distribution
 # via either the GHC_TARBALL or UPSTREAM_* variables.
 
+# Prevent duplicate pipelines for merge requests. :/
+workflow:
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+    - if: $CI_PIPELINE_SOURCE == "pipeline" # Triggered by GHC
+    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
+      when: never
+    - if: $CI_COMMIT_BRANCH
+
 stages:
   - test
   - update-repo
-- 
GitLab