Class: Fastlane::Actions::DangerAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::DangerAction
- Defined in:
- fastlane/lib/fastlane/actions/danger.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, author, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
141 142 143 |
# File 'fastlane/lib/fastlane/actions/danger.rb', line 141 def self. ["KrauseFx"] end |
.available_options ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'fastlane/lib/fastlane/actions/danger.rb', line 45 def self. [ FastlaneCore::ConfigItem.new(key: :use_bundle_exec, env_name: "FL_DANGER_USE_BUNDLE_EXEC", description: "Use bundle exec when there is a Gemfile presented", type: Boolean, default_value: true), FastlaneCore::ConfigItem.new(key: :verbose, env_name: "FL_DANGER_VERBOSE", description: "Show more debugging information", type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :danger_id, env_name: "FL_DANGER_ID", description: "The identifier of this Danger instance", optional: true), FastlaneCore::ConfigItem.new(key: :dangerfile, env_name: "FL_DANGER_DANGERFILE", description: "The location of your Dangerfile", optional: true), FastlaneCore::ConfigItem.new(key: :github_api_token, env_name: "FL_DANGER_GITHUB_API_TOKEN", description: "GitHub API token for danger", sensitive: true, code_gen_sensitive: true, optional: true), FastlaneCore::ConfigItem.new(key: :github_enterprise_host, env_name: "FL_DANGER_GITHUB_ENTERPRISE_HOST", description: "GitHub host URL for GitHub Enterprise", sensitive: true, code_gen_sensitive: true, optional: true), FastlaneCore::ConfigItem.new(key: :github_enterprise_api_base_url, env_name: "FL_DANGER_GITHUB_ENTERPRISE_API_BASE_URL", description: "GitHub API base URL for GitHub Enterprise", sensitive: true, code_gen_sensitive: true, optional: true), FastlaneCore::ConfigItem.new(key: :fail_on_errors, env_name: "FL_DANGER_FAIL_ON_ERRORS", description: "Should always fail the build process, defaults to false", type: Boolean, optional: true, default_value: false), FastlaneCore::ConfigItem.new(key: :new_comment, env_name: "FL_DANGER_NEW_COMMENT", description: "Makes Danger post a new comment instead of editing its previous one", type: Boolean, optional: true, default_value: false), FastlaneCore::ConfigItem.new(key: :remove_previous_comments, env_name: "FL_DANGER_REMOVE_PREVIOUS_COMMENT", description: "Makes Danger remove all previous comment and create a new one in the end of the list", type: Boolean, optional: true, default_value: false), FastlaneCore::ConfigItem.new(key: :base, env_name: "FL_DANGER_BASE", description: "A branch/tag/commit to use as the base of the diff. [master|dev|stable]", optional: true), FastlaneCore::ConfigItem.new(key: :head, env_name: "FL_DANGER_HEAD", description: "A branch/tag/commit to use as the head. [master|dev|stable]", optional: true), FastlaneCore::ConfigItem.new(key: :pr, env_name: "FL_DANGER_PR", description: "Run danger on a specific pull request. e.g. \"https://github.com/danger/danger/pull/518\"", optional: true), FastlaneCore::ConfigItem.new(key: :fail_if_no_pr, env_name: "FL_DANGER_FAIL_IF_NO_PR", description: "Fail Danger execution if no PR is found", type: Boolean, default_value: false) ] end |
.category ⇒ Object
137 138 139 |
# File 'fastlane/lib/fastlane/actions/danger.rb', line 137 def self.category :misc end |
.description ⇒ Object
34 35 36 |
# File 'fastlane/lib/fastlane/actions/danger.rb', line 34 def self.description "Runs `danger` for the project" end |
.details ⇒ Object
38 39 40 41 42 43 |
# File 'fastlane/lib/fastlane/actions/danger.rb', line 38 def self.details [ "Formalize your Pull Request etiquette.", "More information: [https://github.com/danger/danger](https://github.com/danger/danger)." ].join("\n") end |
.example_code ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 |
# File 'fastlane/lib/fastlane/actions/danger.rb', line 125 def self.example_code [ 'danger', 'danger( danger_id: "unit-tests", dangerfile: "tests/MyOtherDangerFile", github_api_token: ENV["GITHUB_API_TOKEN"], verbose: true )' ] end |
.is_supported?(platform) ⇒ Boolean
121 122 123 |
# File 'fastlane/lib/fastlane/actions/danger.rb', line 121 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'fastlane/lib/fastlane/actions/danger.rb', line 4 def self.run(params) Actions.verify_gem!('danger') cmd = [] cmd << 'bundle exec' if params[:use_bundle_exec] && shell_out_should_use_bundle_exec? cmd << 'danger' cmd << '--verbose' if params[:verbose] danger_id = params[:danger_id] dangerfile = params[:dangerfile] base = params[:base] head = params[:head] pr = params[:pr] cmd << "--danger_id=#{danger_id}" if danger_id cmd << "--dangerfile=#{dangerfile}" if dangerfile cmd << "--fail-on-errors=true" if params[:fail_on_errors] cmd << "--fail-if-no-pr=true" if params[:fail_if_no_pr] cmd << "--new-comment" if params[:new_comment] cmd << "--remove-previous-comments" if params[:remove_previous_comments] cmd << "--base=#{base}" if base cmd << "--head=#{head}" if head cmd << "pr #{pr}" if pr ENV['DANGER_GITHUB_API_TOKEN'] = params[:github_api_token] if params[:github_api_token] ENV['DANGER_GITHUB_HOST'] = params[:github_enterprise_host] if params[:github_enterprise_host] ENV['DANGER_GITHUB_API_BASE_URL'] = params[:github_enterprise_api_base_url] if params[:github_enterprise_api_base_url] Actions.sh(cmd.join(' ')) end |