fastlane-plugin-jira_issues_release_notes 0.3.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module JiraIssuesReleaseNotes
3
- VERSION = "0.3.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-jira_issues_release_notes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erick Martins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-25 00:00:00.000000000 Z
11
+ date: 2021-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: jira-ruby
14
+ name: zk-jira-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -159,8 +159,12 @@ files:
159
159
  - LICENSE
160
160
  - README.md
161
161
  - lib/fastlane/plugin/jira_issues_release_notes.rb
162
- - lib/fastlane/plugin/jira_issues_release_notes/actions/branch_jira_issues_release_notes_action.rb
163
- - lib/fastlane/plugin/jira_issues_release_notes/actions/jira_issues_release_notes_action.rb
162
+ - lib/fastlane/plugin/jira_issues_release_notes/actions/jira_comment_action.rb
163
+ - lib/fastlane/plugin/jira_issues_release_notes/actions/jira_feature_validation_action.rb
164
+ - lib/fastlane/plugin/jira_issues_release_notes/actions/jira_issues_keys_from_commits_action.rb
165
+ - lib/fastlane/plugin/jira_issues_release_notes/actions/jira_release_changelog_action.rb
166
+ - lib/fastlane/plugin/jira_issues_release_notes/actions/jira_release_validation_action.rb
167
+ - lib/fastlane/plugin/jira_issues_release_notes/actions/jira_versions_action.rb
164
168
  - lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb
165
169
  - lib/fastlane/plugin/jira_issues_release_notes/version.rb
166
170
  homepage: https://github.com/erick-martins/fastlane-plugin-jira_issues_release_notes
@@ -1,284 +0,0 @@
1
- require 'fastlane/action'
2
- require_relative '../helper/jira_issues_release_notes_helper'
3
-
4
- module Fastlane
5
- module Actions
6
- class JiraIssuesReleaseNotesAction < Action
7
- def self.get_last_tag(params)
8
- # Try to find the tag
9
- command = "git describe --tags --match=#{params[:match]}"
10
- Actions.sh(command, log: params[:debug])
11
- rescue StandardError
12
- UI.message("Tag was not found for match pattern - #{params[:match]}")
13
- ''
14
- end
15
-
16
- def self.get_last_tag_hash(params)
17
- command = "git rev-list -n 1 refs/tags/#{params[:tag_name]}"
18
- Actions.sh(command, log: params[:debug]).chomp
19
- end
20
-
21
- def self.get_commits_from_hash(params)
22
- Helper::JiraIssuesReleaseNotesHelper.git_log(
23
- pretty: '%s|%b|>',
24
- start: params[:hash],
25
- debug: params[:debug]
26
- )
27
- end
28
-
29
- def self.run(params)
30
- tag = get_last_tag(
31
- match: params[:tag_prefix],
32
- debug: params[:debug]
33
- )
34
-
35
- if tag.empty?
36
- UI.message("First commit of the branch is taken as a begining of next release")
37
- # If there is no tag found we taking the first commit of current branch
38
- hash = Actions.sh('git rev-list --max-parents=0 HEAD', log: params[:debug]).chomp
39
- else
40
- # Tag's format is v2.3.4-5-g7685948
41
- # Get a hash of last version tag
42
- tag_name = tag.split('-')[0...-2].join('-').strip
43
- parsed_version = tag_name.match(params[:tag_version_match])
44
-
45
- if parsed_version.nil?
46
- UI.user_error!("Error while parsing version from tag #{tag_name} by using tag_version_match - #{params[:tag_version_match]}. Please check if the tag contains version as you expect and if you are using single brackets for tag_version_match parameter.")
47
- end
48
-
49
- version = parsed_version[0]
50
-
51
- # Get a hash of last version tag
52
- hash = get_last_tag_hash(
53
- tag_name: tag_name,
54
- debug: params[:debug]
55
- )
56
-
57
- UI.message("Found a tag #{tag_name} associated with version #{version}")
58
- end
59
-
60
- # Get commits log between last version and head
61
- commits = get_commits_from_hash(
62
- hash: hash,
63
- debug: params[:debug]
64
- )
65
-
66
- regex = Regexp.new("(#{params[:ticket_prefix]}-\\d+)")
67
-
68
- tickets = tickets(commits: commits, regex: regex)
69
- UI.important("Jira tickets: #{tickets}")
70
-
71
- @jira_helper = Helper::JiraIssuesReleaseNotesHelper.jira_helper(
72
- host: params[:host],
73
- username: params[:username],
74
- password: params[:password],
75
- context_path: params[:context_path],
76
- disable_ssl_verification: params[:disable_ssl_verification]
77
- )
78
- issues = @jira_helper.get(issues: tickets)
79
-
80
- to_validate = issues.select { |issue| params[:to_validate_status].include?(issue.status.name) }
81
- validated = issues.select { |issue| params[:validated_status].include?(issue.status.name) }
82
-
83
- generate_changelog(to_validate: to_validate, validated: validated, format: params[:format], url: params[:build_url])
84
- end
85
-
86
- def self.generate_changelog(to_validate:, validated:, format:, url:)
87
- changelog = []
88
- changelog.concat(format_issues(label: 'Tasks to validate', issues: to_validate, format: format)) unless to_validate.empty?
89
- changelog.concat(['']) unless changelog.to_s.empty?
90
- changelog.concat(format_issues(label: 'Validated tasks', issues: validated, format: format)) unless validated.empty?
91
- # changes = format_issues(issues: issues)
92
- changelog = ['No changes included.'] if changelog.to_s.empty?
93
-
94
- changelog.join("\n")
95
- end
96
-
97
- def self.style_text(text:, format:, style:)
98
- # formats the text according to the style we're looking to use
99
-
100
- # Skips all styling
101
- case style
102
- when "title"
103
- case format
104
- when "markdown"
105
- "# #{text}"
106
- when "slack"
107
- "*#{text}*"
108
- else
109
- text
110
- end
111
- when "heading"
112
- case format
113
- when "markdown"
114
- "### #{text}"
115
- when "slack"
116
- "*#{text}*"
117
- else
118
- "#{text}:"
119
- end
120
- when "bold"
121
- case format
122
- when "markdown"
123
- "**#{text}**"
124
- when "slack"
125
- "*#{text}*"
126
- else
127
- text
128
- end
129
- else
130
- text # catchall, shouldn't be needed
131
- end
132
- end
133
-
134
- def self.format_issue_link(issue:, format:)
135
- # formats the link according to the output format we need
136
-
137
- case format
138
- when "slack"
139
- "*<#{@jira_helper.url(issue: issue)}|#{issue.key}>*: #{issue.summary}"
140
- when "markdown"
141
- "- **[#{issue.key}](#{@jira_helper.url(issue: issue)})**: #{issue.summary}"
142
- else
143
- "- #{issue.key}: #{issue.summary} (#{@jira_helper.url(issue: issue)})"
144
- end
145
- end
146
-
147
- def self.format_issues(label:, issues:, format:)
148
- [
149
- style_text(text: "► #{label}", style: 'heading', format: format),
150
- issues.map { |issue| format_issue_link(issue: issue, format: format) }
151
- ].flatten!
152
- end
153
-
154
- def self.tickets(commits:, regex:)
155
- commits
156
- .to_enum(:scan, regex)
157
- .map { $& }
158
- .reject(&:empty?)
159
- .uniq
160
- end
161
-
162
- def self.description
163
- "It generates a release note based on the issues keys and descriptions found in the commits"
164
- end
165
-
166
- def self.authors
167
- ["Erick Martins"]
168
- end
169
-
170
- def self.return_value
171
- # If your method provides a return value, you can describe here what it does
172
- end
173
-
174
- def self.details
175
- # Optional:
176
- "It generates a release note based on the issues keys and descriptions found in the commits"
177
- end
178
-
179
- def self.available_options
180
- [
181
- FastlaneCore::ConfigItem.new(
182
- key: :tag_prefix,
183
- description: "Match parameter of git describe. See man page of git describe for more info",
184
- verify_block: proc do |value|
185
- UI.user_error!("No match for analyze_commits action given, pass using `match: 'expr'`") unless value && !value.empty?
186
- end
187
- ),
188
- FastlaneCore::ConfigItem.new(
189
- key: :ticket_prefix,
190
- env_name: 'FL_FIND_TICKETS_MATCHING',
191
- description: 'regex to extract ticket numbers',
192
- default_value: '[A-Z]+',
193
- optional: true
194
- ),
195
- FastlaneCore::ConfigItem.new(
196
- key: :tag_version_match,
197
- description: "To parse version number from tag name",
198
- default_value: '\d+\.\d+\.\d+'
199
- ),
200
- FastlaneCore::ConfigItem.new(
201
- key: :build_url,
202
- env_name: 'FL_RELEASE_NOTES_BUILD_URL',
203
- description: 'Link to the ci build',
204
- optional: true,
205
- default_value: ENV['BUILD_URL']
206
- ),
207
- FastlaneCore::ConfigItem.new(
208
- key: :validated_status,
209
- env_name: 'FL_JIRA_VALIDATED_STATUS',
210
- description: 'List of jira issues status already validated',
211
- optional: false,
212
- type: Array
213
- ),
214
- FastlaneCore::ConfigItem.new(
215
- key: :to_validate_status,
216
- env_name: 'FL_JIRA_TO_VALIDATE_STATUS',
217
- description: 'List of jira issues status to be validated',
218
- optional: false,
219
- type: Array
220
- ),
221
- FastlaneCore::ConfigItem.new(
222
- key: :format,
223
- description: "You can use either markdown, slack or plain",
224
- default_value: "markdown",
225
- optional: true,
226
- verify_block: proc do |value|
227
- UI.user_error!("Invalid format! You can use either markdown, slack or plain") unless ['markdown', 'slack', 'plain'].include?(value)
228
- end
229
- ),
230
-
231
- # Jira Client options
232
- FastlaneCore::ConfigItem.new(
233
- key: :username,
234
- env_name: 'FL_JIRA_USERNAME',
235
- description: 'Jira user',
236
- optional: false
237
- ),
238
- FastlaneCore::ConfigItem.new(
239
- key: :password,
240
- env_name: 'FL_JIRA_PASSWORD',
241
- description: 'Jira user',
242
- optional: false
243
- ),
244
- FastlaneCore::ConfigItem.new(
245
- key: :host,
246
- env_name: 'FL_JIRA_HOST',
247
- description: 'Jira location',
248
- optional: false
249
- ),
250
- FastlaneCore::ConfigItem.new(
251
- key: :context_path,
252
- env_name: 'FL_JIRA_CONTEXT_PATH',
253
- description: 'Jira context path',
254
- optional: true,
255
- default_value: ''
256
- ),
257
- FastlaneCore::ConfigItem.new(
258
- key: :disable_ssl_verification,
259
- env_name: 'FL_JIRA_DISABLE_SSL_VERIFICATION',
260
- description: 'Jira SSL Verification mode',
261
- optional: true,
262
- default_value: false,
263
- type: Boolean
264
- ),
265
- FastlaneCore::ConfigItem.new(
266
- key: :debug,
267
- description: "True if you want to log out a debug info",
268
- default_value: false,
269
- type: Boolean,
270
- optional: true
271
- )
272
- ]
273
- end
274
-
275
- def self.is_supported?(platform)
276
- # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
277
- # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
278
- #
279
- # [:ios, :mac, :android].include?(platform)
280
- true
281
- end
282
- end
283
- end
284
- end