Skip to content

Commit

Permalink
ci: treat all non-protected branches as pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Dec 9, 2024
1 parent 7c00c86 commit f49ac7a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f49ac7a

Please sign in to comment.