From 5eba65f0976f57f4a0fb929fe82710c43b0367c2 Mon Sep 17 00:00:00 2001 From: Mike Gerber Date: Fri, 12 Jan 2024 16:08:26 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20GitLab=20CI=20Test:=20Trigger=20?= =?UTF-8?q?only=20on=20default=20branch=20(and=20do=20not=20hardcode=20it)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 2 ++ .gitlab/mirror.yml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f1c4fdd..7b252af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,3 +11,5 @@ mirror: stage: triggers trigger: include: .gitlab/mirror.yml + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH diff --git a/.gitlab/mirror.yml b/.gitlab/mirror.yml index d99cafc..86a4021 100644 --- a/.gitlab/mirror.yml +++ b/.gitlab/mirror.yml @@ -17,8 +17,10 @@ pull-github: script: - whoami; env + - if [ -z "$CI_COMMIT_BRANCH" ]; then echo "Not on a branch" >&2; exit 3; fi + - git remote remove github 2>/dev/null || true - git remote add github https://github.com/qurator-spk/dinglehopper.git - git remote -v - - git pull github master + - git pull github "$CI_COMMIT_BRANCH"