Commit fdc47800 authored by trakos's avatar trakos

Fix head of commit in danger_as_local for drafts and forks

Variable CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is available only in
merged results pipelines. We should fallback to CI_COMMIT_SHA
in other use cases, as merged results pipeline is not used for drafts
and MRs run against forks.
parent bfc8ba04
......@@ -172,5 +172,5 @@ function danger_as_local() {
# Force danger to skip CI source GitLab and fallback to "local only git repo".
unset GITLAB_CI
# We need to base SHA to help danger determine the base commit for this shallow clone.
bundle exec danger dry_run --fail-on-errors=true --verbose --base="${CI_MERGE_REQUEST_DIFF_BASE_SHA}" --head="${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}"
bundle exec danger dry_run --fail-on-errors=true --verbose --base="${CI_MERGE_REQUEST_DIFF_BASE_SHA}" --head="${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment