File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,22 @@ stages:
6565 - pip3 install jinja2
6666
6767 # Setup some environment variables
68- - if [ "$CI_EXTERNAL_PULL_REQUEST_IID" != "" ]; then export PULL_REQUEST="true"; else export PULL_REQUEST="false"; fi
68+ - |
69+ if [ "$CI_EXTERNAL_PULL_REQUEST_IID" != "" ]; then
70+ export PULL_REQUEST="true"
71+ else
72+ # CI_EXTERNAL_PULL_REQUEST_IID is false every time until https://gitlab.com/gitlab-org/gitlab/issues/5667 is done
73+ # Until then, we're using https://github.com/brndnmtthws/labhub atm to mirror Github pull requests as branches into Gitlab,
74+ # which allows us to use Gitlab CI for Github. The following check detects such mirrored branches.
75+ if [[ $CI_COMMIT_REF_NAME =~ ^pr-[^/]*/[^/]*/[^/]*/[^/]*$ ]]; then
76+ export PULL_REQUEST="true"
77+ # CI_COMMIT_BEFORE_SHA is also invalid until #5667 is implemented, so we need to figure it out by ourself
78+ git fetch origin develop
79+ export CI_COMMIT_BEFORE_SHA="$(git merge-base origin/develop HEAD)"
80+ else
81+ export PULL_REQUEST="false"
82+ fi
83+ fi
6984 - export COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"
7085 - export JOB_NUMBER="$CI_JOB_ID"
7186 - export HOST_SRC_DIR=$CI_PROJECT_DIR
You can’t perform that action at this time.
0 commit comments