diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-09-06 09:22:02 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-09-06 09:22:02 +0300 |
commit | 351d72cbed57c5b117e6b2239dffabcedbc45046 (patch) | |
tree | 0c1d87332450741f710e159485a0f1e8899767ee /lib/tasks/gitlab_danger.rake | |
parent | 13227500f29d8a74c77cba23b7dfdb4169222821 (diff) | |
parent | 70e1a17604a45419b079ab9da5ef69e010b103c6 (diff) |
Merge branch '66596-allow-danger-to-be-run-locally' into 'master'
Break up Danger rules into local or CI only
See merge request gitlab-org/gitlab-ce!32196
Diffstat (limited to 'lib/tasks/gitlab_danger.rake')
-rw-r--r-- | lib/tasks/gitlab_danger.rake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/tasks/gitlab_danger.rake b/lib/tasks/gitlab_danger.rake new file mode 100644 index 00000000000..c2f5843a9a5 --- /dev/null +++ b/lib/tasks/gitlab_danger.rake @@ -0,0 +1,17 @@ +desc 'Run local Danger rules' +task :danger_local do + require 'gitlab_danger' + require_relative '../../lib/gitlab/popen' + + puts("#{GitlabDanger.local_warning_message}\n") + + # _status will _always_ be 0, regardless of failure or success :( + output, _status = Gitlab::Popen.popen(%w{danger dry_run}) + + if output.empty? + puts(GitlabDanger.success_message) + else + puts(output) + exit(1) + end +end |