mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Fix pull request detection in .gitlab-ci.yml (#3256)
* Fix pull request detection on Gitlab CI * Fix CI_COMMIT_BEFORE_SHA
This commit is contained in:
parent
d2c85b9ea1
commit
957ffa259c
@ -65,7 +65,22 @@ stages:
|
||||
- pip3 install jinja2
|
||||
|
||||
# Setup some environment variables
|
||||
- if [ "$CI_EXTERNAL_PULL_REQUEST_IID" != "" ]; then export PULL_REQUEST="true"; else export PULL_REQUEST="false"; fi
|
||||
- |
|
||||
if [ "$CI_EXTERNAL_PULL_REQUEST_IID" != "" ]; then
|
||||
export PULL_REQUEST="true"
|
||||
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
|
||||
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"
|
||||
- export JOB_NUMBER="$CI_JOB_ID"
|
||||
- export HOST_SRC_DIR=$CI_PROJECT_DIR
|
||||
|
Loading…
Reference in New Issue
Block a user