Add new danger_local Rake task

The benefit of running the danger_local Rake task
is that it displays some informational messages
for clarity and also exits with 1 if there's any
output.
This commit is contained in:
Ash McKenzie 2019-08-26 17:05:45 +10:00
parent 75dae7fe80
commit fdc17ebc03
No known key found for this signature in database
GPG Key ID: A1253B4953E8D3E6
1 changed files with 17 additions and 0 deletions

View File

@ -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