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.
This commit is contained in:
parent
bfc8ba04c6
commit
fdc47800f5
|
@ -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}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue