Sha256: 1fe6744b7930c7d23da871269e4219b26ab3c9cd043c7a9334db839794f943a3
Contents?: true
Size: 1.89 KB
Versions: 2
Compression:
Stored size: 1.89 KB
Contents
module Danger class Executor def initialize(system_env) @system_env = system_env end def run(env: nil, dm: nil, cork: nil, base: nil, head: nil, dangerfile_path: nil, danger_id: nil) cork ||= Cork::Board.new(silent: false, verbose: false) # Could we find a CI source at all? unless EnvironmentManager.local_ci_source(@system_env) abort("Could not find the type of CI for Danger to run on.".red) end # Could we determine that the CI source is inside a PR? unless EnvironmentManager.pr?(@system_env) cork.puts "Not a Pull Request - skipping `danger` run".yellow return end # OK, then we can have some env ||= EnvironmentManager.new(@system_env) dm ||= Dangerfile.new(env, cork) dm.init_plugins dm.env.fill_environment_vars begin dm.env.ensure_danger_branches_are_setup # Offer the chance for a user to specify a branch through the command line ci_base = base || EnvironmentManager.danger_base_branch ci_head = head || EnvironmentManager.danger_head_branch dm.env.scm.diff_for_folder(".", from: ci_base, to: ci_head) # Parse the local Dangerfile dm.parse(Pathname.new(dangerfile_path)) post_results(dm, danger_id) dm.print_results ensure dm.env.clean_up end end def post_results(danger_file, danger_id) request_source = danger_file.env.request_source violations = danger_file.violation_report status = danger_file.status_report request_source.update_pull_request!( warnings: violations[:warnings], errors: violations[:errors], messages: violations[:messages], markdowns: status[:markdowns], danger_id: danger_id ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
danger-3.3.2 | lib/danger/danger_core/executor.rb |
danger-3.3.1 | lib/danger/danger_core/executor.rb |