ci: When finding common ancestors use source branch or commit branch.
The merge target branch will always be our master
branch, we need to compare the source branch. There are 3 possible ways to derive this:
-
CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME
- external branch merge pipelines -
CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
- general merge pipelines -
CI_COMMIT_BRANCH
- commit-only pipelines
If all else fails we still fall back on CI_DEFAULT_BRANCH
.