Class: Fastlane::Actions::JiraReleaseNotesAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::JiraReleaseNotesAction
- Defined in:
- lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_type ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
141 142 143 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 141 def self. ["Alexander Ignition"] end |
.available_options ⇒ Object
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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 81 def self. [ FastlaneCore::ConfigItem.new(key: :url, env_name: "FL_JIRA_SITE", description: "URL for Jira instance", verify_block: proc do |value| UI.user_error!("No url for Jira given") if value.to_s.length == 0 end), FastlaneCore::ConfigItem.new(key: :username, env_name: "FL_JIRA_USERNAME", description: "Username for Jira instance", verify_block: proc do |value| UI.user_error!("No username") if value.to_s.length == 0 end), FastlaneCore::ConfigItem.new(key: :password, env_name: "FL_JIRA_PASSWORD", description: "Password or api token for Jira", sensitive: true, verify_block: proc do |value| UI.user_error!("No password") if value.to_s.length == 0 end), FastlaneCore::ConfigItem.new(key: :project, env_name: "FL_JIRA_PROJECT", description: "Jira project name", sensitive: true, verify_block: proc do |value| UI.user_error!("No Jira project name") if value.to_s.length == 0 end), FastlaneCore::ConfigItem.new(key: :status, env_name: "FL_JIRA_STATUS", description: "Jira issue status", sensitive: true, default_value: ""), FastlaneCore::ConfigItem.new(key: :components, env_name: "FL_JIRA_COMPONENTS", description: "Jira issue components", type: Array, sensitive: true, default_value: ""), FastlaneCore::ConfigItem.new(key: :version, env_name: "FL_JIRA_PROJECT_VERSION", description: "Jira project version", sensitive: true, is_string: false, verify_block: proc do |value| UI.user_error!("'version' value must be a String or Regexp! Found #{value.class} instead.") unless value.kind_of?(String) || value.kind_of?(Regexp) UI.user_error!("No Jira project version") if value.to_s.length == 0 end), FastlaneCore::ConfigItem.new(key: :format, env_name: "FL_JIRA_RELEASE_NOTES_FORMAT", description: "Format text. Plain, html or none", sensitive: true, default_value: "plain"), FastlaneCore::ConfigItem.new(key: :max_results, env_name: "FL_JIRA_RELEASE_NOTES_MAX_RESULTS", description: "Maximum number of issues", default_value: "50") ] end |
.category ⇒ Object
170 171 172 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 170 def self.category :misc end |
.description ⇒ Object
65 66 67 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 65 def self.description "Jira release notes" end |
.details ⇒ Object
69 70 71 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 69 def self.details "Fetch release notes for Jira project for version" end |
.example_code ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 149 def self.example_code [ 'notes = jira_release_notes( url: "https://bugs.yourdomain.com", username: "Your username", password: "Your password", project: "ABC", version: "1.0" ) gym crashlytics(notes: notes)', 'notes = jira_release_notes( project: "ABC", version: "1.0", format: "html" ) gym slack(message: notes)' ] end |
.is_supported?(platform) ⇒ Boolean
145 146 147 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 145 def self.is_supported?(platform) true end |
.return_type ⇒ Object
77 78 79 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 77 def self.return_type :string end |
.return_value ⇒ Object
73 74 75 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 73 def self.return_value "List of issues from jira. Formatted string or class" 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fastlane/plugin/jira_release_notes/actions/jira_release_notes_action.rb', line 4 def self.run(params) Actions.verify_gem!('jira-ruby') require 'jira-ruby' client = JIRA::Client.new( username: params[:username], password: params[:password], site: params[:url], context_path: '', auth_type: :basic ) version = params[:version] project = params[:project] status = params[:status] components = params[:components] max_results = params[:max_results].to_i issues = [] UI.("Fetch issues from JIRA project '#{project}', version '#{version}'") begin if version.kind_of?(Regexp) versions = client.Project.find(project).versions .select { |v| version.match(v.name) } .map { |v| "'#{v.name}'" } .join(', ') jql = "PROJECT = '#{project}' AND fixVersion in (#{versions})" else jql = "PROJECT = '#{project}' AND fixVersion = '#{version}'" end unless status.nil? or status.empty? jql += " AND status = '#{status}'" end unless components.nil? or components.empty? jql += " AND component in (#{components.map{|s| "\"#{s}\""}.join(", ")})" end UI.("jql '#{jql}'") issues = client.Issue.jql(jql,max_results: max_results) rescue JIRA::HTTPError => e fields = [e.code, e.] fields << e.response.body if e.response.content_type == "application/json" UI.user_error!("#{e} #{fields.join(', ')}") end UI.success("📝 #{issues.count} issues from JIRA project '#{project}', version '#{version}', status '#{status}', components '#{components}'") case params[:format] when "plain" Helper::JiraReleaseNotesHelper.plain_format(issues) when "html" Helper::JiraReleaseNotesHelper.html_format(issues, params[:url]) else issues end end |