From 999d91d741c4a709e2629a059e4f093eab5fc758 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Thu, 2 Jul 2020 12:30:02 +0200
Subject: [PATCH] [ci] Disable for non-MR user-scoped pipelines.

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index eb1763a1da8..920bd375c4d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,8 +21,16 @@ variables:
   BUILD_TESTS: "true"
   BUILD_CTEST: "true"
 
+workflow:
+  rules:
+    # Disable CI for non-MR user-scoped pipelines
+    - if: '$CI_MERGE_REQUEST_IID == null && $CI_PROJECT_NAMESPACE != "ogs"'
+      when: never
+    - if: $CI_MERGE_REQUEST_IID                    # merge requests
+    - if: $CI_COMMIT_TAG                           # tags, ogs/ogs repo only
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH  # master, ogs/ogs repo only
+
 include:
-  - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
   - template: 'Code-Quality.gitlab-ci.yml'
   # extends
   - local: '/scripts/ci/extends/defaults.yml'
-- 
GitLab