Commit 72421e8e authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add a new job running danger as local to test it

parent d1d85326
......@@ -247,10 +247,14 @@ danger-review:
script:
- >
if [ -z "$DANGER_GITLAB_API_TOKEN" ]; then
# 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.
run_timed_command "bundle exec danger dry_run --fail-on-errors=true --verbose --base='$CI_MERGE_REQUEST_DIFF_BASE_SHA'"
run_timed_command danger_as_local
else
run_timed_command "bundle exec danger --fail-on-errors=true --verbose"
fi
danger-review-local:
extends:
- danger-review
- .review:rules:danger-local
script:
- run_timed_command danger_as_local
......@@ -330,6 +330,12 @@
- ".dockerignore"
- "qa/**/*"
.code-backstage-danger-patterns: &code-backstage-danger-patterns
# Backstage changes
- "Dangerfile"
- "danger/**/*"
- "tooling/danger/**/*"
################
# Shared rules #
################
......@@ -1284,6 +1290,11 @@
rules:
- if: '$CI_MERGE_REQUEST_IID'
.review:rules:danger-local:
rules:
- if: '$CI_MERGE_REQUEST_IID'
changes: *code-backstage-danger-patterns
###############
# Setup rules #
###############
......
......@@ -134,3 +134,10 @@ function fail_pipeline_early() {
scripts/api/cancel_pipeline.rb
fi
}
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}"
}
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