diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1a09869cfb7c8bba5e6753e38eda2ef72600896b..04e955245420848112bde32006da58ba45903209 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -138,8 +138,8 @@ deploy:vm:
     - echo "$KNOWNHOSTS" > ~/.ssh/known_hosts
     - chmod 644 ~/.ssh/known_hosts
   rules:
-    - if: '!$CI_MERGE_REQUEST_ID && $CI_COMMIT_REF_NAME == "develop" && $CI_PROJECT_PATH == "R3/howto-cards"'
-    - if: '!$CI_MERGE_REQUEST_ID && $CI_COMMIT_REF_NAME == "master" && $CI_PROJECT_PATH == "R3/howto-cards"'
+    - if: '$CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_REF_NAME == "develop" && $CI_PROJECT_PATH == "R3/howto-cards"'
+    - if: '$CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_REF_NAME == "master" && $CI_PROJECT_PATH == "R3/howto-cards"'
   script:
     - ssh -p $SSHPORT $SSHCONNECT "mkdir -p ~/$CI_COMMIT_REF_NAME/sources/public/$CI_JOB_ID ~/$CI_COMMIT_REF_NAME/public"
     - scp -P $SSHPORT -r processed_build/* $SSHCONNECT:~/$CI_COMMIT_REF_NAME/sources/public/$CI_JOB_ID