fix: commitlint use correct SHA in --from
The variable $CI_MERGE_REQUEST_TARGET_BRANCH_SHA
is only available to
pipelines for merged results and that is only available to maintainers
of a project as listed in the prerequsites. This causes the commitlint
job to fail when the merge request is not originated by a maintainer as it checks a list of commits not just the current ones. For example https://gitlab.com/gitlab-org/container-registry/-/jobs/1454408675
This is an attempt to get the correct commit using git merge-base
, however it requires fetching the target branch so it is known to git in the current context. Maybe there is a way to configure the job to clone the default branch as well?
Edited by Jaime Martinez