diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6af1abbbe6382b..effd5a9ec3c0d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -95,14 +95,16 @@ builder-image: else # CI_EXTERNAL_PULL_REQUEST_IID is false every time until https://gitlab.com/gitlab-org/gitlab/issues/5667 is done # Until then, we're using https://github.com/brndnmtthws/labhub atm to mirror Github pull requests as branches into Gitlab, - # which allows us to use Gitlab CI for Github. The following check detects such mirrored branches. - if [[ $CI_COMMIT_REF_NAME =~ ^pr-[^/]*/[^/]*/[^/]*/[^/]*$ ]]; then + # which allows us to use Gitlab CI for Github. + if [[ $CI_COMMIT_REF_NAME = "master" ]] || [[ $CI_COMMIT_REF_NAME = "develop" ]] || [[ $CI_COMMIT_REF_NAME =~ ^v([0-9]{1,2}\.)*x$ ]]; then + # These names are reserved for protected branches + export PULL_REQUEST="false" + else + # Everything else including experemental "feat/smth" branches must be merged via PRs export PULL_REQUEST="true" # CI_COMMIT_BEFORE_SHA is also invalid until #5667 is implemented, so we need to figure it out by ourself git fetch origin develop export CI_COMMIT_BEFORE_SHA="$(git merge-base origin/develop HEAD)" - else - export PULL_REQUEST="false" fi fi - export COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"