From 0dc07ad21606115494eccb55335e68f89d91eaf6 Mon Sep 17 00:00:00 2001
From: laurentheirendt <laurent.heirendt@uni.lu>
Date: Mon, 6 Apr 2020 14:39:29 +0200
Subject: [PATCH] add explicit condition for MRs

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e6c41801..06d8ebd0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,7 +21,7 @@ build_pages:
   before_script:
     - apt-get -qq update
     - apt-get install -y -qq git-lfs
-    - gem install bundler:2.0.2 && bundle install  
+    - gem install bundler:2.0.2 && bundle install
   script:
     - bash .ci/deploy.sh
   variables:
@@ -71,8 +71,11 @@ build pages for VM deployment:
     expire_in: 1 day
     paths:
       - new_build
+  rules:
+    - if: $CI_COMMIT_BRANCH
+    - if: $CI_MERGE_REQUEST_ID
   before_script:
-    - gem install bundler:$BUNDLER_VERSION && bundle install  
+    - gem install bundler:$BUNDLER_VERSION && bundle install
   script:
     # Generate the configuration for forks (will use Gitlab Pages on personal namespaces)
     - 'echo "url: https://$CI_PROJECT_NAMESPACE.$CI_PAGES_DOMAIN" >> .ci/_config_gitlab_pages.yml'
@@ -97,6 +100,9 @@ generate the search index for VM deployment:
   script:
     - bash .ci/build_indices_new.sh
     - mv new_build new_processed_build
+  rules:
+    - if: $CI_COMMIT_BRANCH
+    - if: $CI_MERGE_REQUEST_ID
   artifacts:
     expire_in: 1 day
     paths:
@@ -108,6 +114,7 @@ new pages:
   stage: deploy
   rules:
     - if: '$CI_PROJECT_NAMESPACE != "R3" && $CI_PROJECT_NAMESPACE != "R3-core"'
+    - if: $CI_MERGE_REQUEST_ID
   script:
     - mv new_processed_build new_public
   artifacts:
-- 
GitLab