2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
desc 'Run local Danger rules'
|
|
|
|
task :danger_local do
|
2021-04-17 20:07:23 +05:30
|
|
|
require_relative '../../tooling/danger/project_helper'
|
2019-12-04 20:38:33 +05:30
|
|
|
require 'gitlab/popen'
|
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
puts("#{Tooling::Danger::ProjectHelper.local_warning_message}\n")
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
# _status will _always_ be 0, regardless of failure or success :(
|
|
|
|
output, _status = Gitlab::Popen.popen(%w{danger dry_run})
|
|
|
|
|
|
|
|
if output.empty?
|
2021-04-17 20:07:23 +05:30
|
|
|
puts(Tooling::Danger::ProjectHelper.success_message)
|
2019-12-04 20:38:33 +05:30
|
|
|
else
|
|
|
|
puts(output)
|
|
|
|
exit(1)
|
|
|
|
end
|
|
|
|
end
|