fastlane-plugin-jira_issues_release_notes 0.1.0 → 0.4.0
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.
- checksums.yaml +4 -4
- data/README.md +125 -7
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/branch_jira_issues_release_notes_action.rb +235 -0
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/jira_issues_release_notes_action.rb +33 -28
- data/lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb +5 -2
- data/lib/fastlane/plugin/jira_issues_release_notes/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f58449be91ef1bc4890ad8e1e3cff0048df15f6eabcab019b84f6e1eed4f115c
|
4
|
+
data.tar.gz: 87d076d95e1d5e6e3c4b33457a11cab52abc6b6ad97fb22bdcb9b2ba685d300d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59d229f4caf627261ae8f25a760e850ccea0ee32e502459466d10dd23429bd760d8ecfc612e6d76496f31c692d1aa047bf55d3afd9133a2a23b01384b4ce58cc
|
7
|
+
data.tar.gz: 3ac248ade9dbda28ca71c0eaa089598628dc7d516992451194eb71341de0a8ef10f558563a85cd6eeb3e78c78f062b4c8e32df995e2d02181524dd250189d779
|
data/README.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# Jira Issues Release Notes - Fastlane Plugin
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/fastlane-plugin-jira_issues_release_notes)
|
4
4
|
|
5
|
+
|
6
|
+
|
7
|
+
It generates a release note based on the issues keys and descriptions found in the commits and branch name
|
8
|
+
|
9
|
+
|
10
|
+
|
5
11
|
## Getting Started
|
6
12
|
|
7
13
|
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-jira_issues_release_notes`, add it to your project by running:
|
@@ -10,17 +16,121 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
|
|
10
16
|
fastlane add_plugin jira_issues_release_notes
|
11
17
|
```
|
12
18
|
|
13
|
-
## About jira_issues_release_notes
|
14
19
|
|
15
|
-
It generates a release note based on the issues keys and descriptions found in the commits
|
16
20
|
|
17
|
-
|
21
|
+
## Actions
|
22
|
+
|
23
|
+
All actions requires some parameters to access Jira API.
|
24
|
+
**These are the arguments the all share:**
|
25
|
+
|
26
|
+
| Argument | Type | Description | Optional | Default | Env Name |
|
27
|
+
| ------------------------ | --------- | -------------------------------- | -------- | ------- | ---------------------------------- |
|
28
|
+
| username | `String` | The prefix for yours jira issues | | | `FL_JIRA_USERNAME` |
|
29
|
+
| password | `String` | Jira user password | | | `FL_JIRA_PASSWORD` |
|
30
|
+
| host | `String` | Jira location | | | `FL_JIRA_HOST` |
|
31
|
+
| context_path | `String` | Jira context path | ✓ | Empty | `FL_JIRA_CONTEXT_PATH` |
|
32
|
+
| disable_ssl_verification | `Boolean` | Jira SSL Verification mode | ✓ | `false` | `FL_JIRA_DISABLE_SSL_VERIFICATION` |
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
### branch_jira_issues_release_notes
|
37
|
+
|
38
|
+
This action creates a release note based on the issue key extracted from your branch name. For example a branch called `feature/ABC-1234-some-feature` will extract the `ABC-1234` issue key.
|
39
|
+
|
40
|
+
It should be used to generate version to validate you branch's feature before you merge it.
|
41
|
+
|
42
|
+
**Arguments:**
|
43
|
+
|
44
|
+
| Argument | Type | Description | Optional | Default | Env Name |
|
45
|
+
| ------------- | --------------------------------------- | ------------------------------------------------------------ | -------- | -------------------- | -------------------------- |
|
46
|
+
| ticket_prefix | `String` or `Regex` | The prefix for yours jira issues | ✓ | `[A_Z]+` | `FL_FIND_TICKETS_MATCHING` |
|
47
|
+
| extra_fields | `Hash` | A hash of extra Jira fields to display.<br />It should be a hash with key as the label for the key and value as the symbol representing the jira's key:<br />Example: `{ "My Custom Field" => :customfield_1 }` | ✓ | Empty Hash<br />`{}` | |
|
48
|
+
| format | `slack`, `markdown` , `html` or `plain` | Defines the result format | ✓ | `markdown` | |
|
49
|
+
|
50
|
+
**Usage example:**
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
# Branch: feature/ABC-1234-some-feature
|
54
|
+
|
55
|
+
platform :android do
|
56
|
+
lane :develop do
|
57
|
+
# Build a apk for development environment
|
58
|
+
build_develop
|
59
|
+
link_to_download = upload_to_s3
|
60
|
+
|
61
|
+
release_notes = branch_jira_issues_release_notes(
|
62
|
+
ticket_prefix: 'ABC',
|
63
|
+
username: ENV["FL_JIRA_USERNAME"],
|
64
|
+
password: ENV["FL_JIRA_PASSWORD"],
|
65
|
+
host: ENV["FL_JIRA_HOST"],
|
66
|
+
format: 'slack',
|
67
|
+
extra_fields: {
|
68
|
+
"What should we test?" => :customfield_1
|
69
|
+
}
|
70
|
+
)
|
71
|
+
|
72
|
+
slack(
|
73
|
+
pretext: ":android: A new android build is available for feature validation\n#{release_notes}",
|
74
|
+
payload: {
|
75
|
+
"Donwload it here" => link_to_download
|
76
|
+
},
|
77
|
+
success: true
|
78
|
+
)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
```
|
18
82
|
|
19
|
-
## Example
|
20
83
|
|
21
|
-
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
22
84
|
|
23
|
-
|
85
|
+
### jira_issues_release_notes
|
86
|
+
|
87
|
+
This action creates a changelog based on the issue keys extracted from your commits since the latest published tag.
|
88
|
+
|
89
|
+
It should be used to generate version to validate in QA stage.
|
90
|
+
|
91
|
+
**Usage example:**
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
platform :android do
|
95
|
+
lane :develop do
|
96
|
+
# Build a apk for staging environment
|
97
|
+
build_staging
|
98
|
+
link_to_download = upload_to_s3
|
99
|
+
|
100
|
+
release_notes = jira_issues_release_notes(
|
101
|
+
tag_prefix: 'v*',
|
102
|
+
ticket_prefix: 'ABC',
|
103
|
+
username: ENV["FL_JIRA_USERNAME"],
|
104
|
+
password: ENV["FL_JIRA_PASSWORD"],
|
105
|
+
host: ENV["FL_JIRA_HOST"],
|
106
|
+
validated_status: ['To Deploy', 'Done'],
|
107
|
+
to_validate_status: ['To Test', 'To QA'],
|
108
|
+
format: 'slack',
|
109
|
+
)
|
110
|
+
|
111
|
+
slack(
|
112
|
+
pretext: ":android: A new android build is available for QA\n#{release_notes}",
|
113
|
+
payload: {
|
114
|
+
"Donwload it here" => link_to_download
|
115
|
+
},
|
116
|
+
success: true
|
117
|
+
)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
```
|
121
|
+
|
122
|
+
**Arguments:**
|
123
|
+
|
124
|
+
| Argument | Type | Description | Optional | Default | Env Name |
|
125
|
+
| ------------------ | --------------------------------------- | ---------------------------------------------- | -------- | ----------------- | -------------------------- |
|
126
|
+
| tag_prefix | `Regex` | Match prefix to find latest tag. Example: `v*` | | | |
|
127
|
+
| ticket_prefix | `String` or `Regex` | The prefix for yours jira issues | ✓ | `[A_Z]+` | `FL_FIND_TICKETS_MATCHING` |
|
128
|
+
| tag_version_match | `String` | To parse version number from tag name | ✓ | `/\d+\.\d+\.\d+/` | |
|
129
|
+
| validated_status | `Array` | List of jira issues status already validated | | | FL_JIRA_VALIDATED_STATUS |
|
130
|
+
| to_validate_status | `Array` | List of jira issues status to be validated | | | FL_JIRA_TO_VALIDATE_STATUS |
|
131
|
+
| format | `slack`, `markdown` , `html` or `plain` | Defines the result format | ✓ | `markdown` | |
|
132
|
+
|
133
|
+
|
24
134
|
|
25
135
|
## Run tests for this plugin
|
26
136
|
|
@@ -35,18 +145,26 @@ To automatically fix many of the styling issues, use
|
|
35
145
|
rubocop -a
|
36
146
|
```
|
37
147
|
|
148
|
+
|
149
|
+
|
38
150
|
## Issues and Feedback
|
39
151
|
|
40
152
|
For any other issues and feedback about this plugin, please submit it to this repository.
|
41
153
|
|
154
|
+
|
155
|
+
|
42
156
|
## Troubleshooting
|
43
157
|
|
44
158
|
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
45
159
|
|
160
|
+
|
161
|
+
|
46
162
|
## Using _fastlane_ Plugins
|
47
163
|
|
48
164
|
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
49
165
|
|
166
|
+
|
167
|
+
|
50
168
|
## About _fastlane_
|
51
169
|
|
52
170
|
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,235 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/jira_issues_release_notes_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class BranchJiraIssuesReleaseNotesAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
branch = other_action.git_branch
|
9
|
+
regex = Regexp.new("(#{params[:ticket_prefix]}-\\d+)")
|
10
|
+
|
11
|
+
@format = params[:format]
|
12
|
+
@extra_fields = params[:extra_fields]
|
13
|
+
@format_line_break = @format === 'html' ? '<br />' : "\n"
|
14
|
+
|
15
|
+
ticket_code = regex.match branch
|
16
|
+
|
17
|
+
return ticket_not_found unless ticket_code
|
18
|
+
|
19
|
+
UI.message "Found ticket code: #{ticket_code}"
|
20
|
+
|
21
|
+
|
22
|
+
@jira_helper = Helper::JiraIssuesReleaseNotesHelper.jira_helper(
|
23
|
+
host: params[:host],
|
24
|
+
username: params[:username],
|
25
|
+
password: params[:password],
|
26
|
+
context_path: params[:context_path],
|
27
|
+
disable_ssl_verification: params[:disable_ssl_verification]
|
28
|
+
)
|
29
|
+
|
30
|
+
issue = @jira_helper.get(issues: [ticket_code], extra_fields: @extra_fields.values).first
|
31
|
+
|
32
|
+
return ticket_not_found ticket_code unless issue
|
33
|
+
|
34
|
+
generate_message_with(issue: issue)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.ticket_not_found(ticket_code = "")
|
38
|
+
|
39
|
+
UI.important "No ticket code could be extracted from git branch name."
|
40
|
+
UI.message "Trying to use latest git commit"
|
41
|
+
last_commit = other_action.last_git_commit
|
42
|
+
return UI.error "There is no commit" unless last_commit
|
43
|
+
header_text = ticket_code ? "😅 Jira issue with key '#{ticket_code}' could not be found" : "😅 Jira issue could not be detected"
|
44
|
+
|
45
|
+
return [
|
46
|
+
style_text(text: header_text, style: 'heading'),
|
47
|
+
style_text(text: "► Latest Commit:", style: 'bold'),
|
48
|
+
last_commit[:message]
|
49
|
+
].join("\n")
|
50
|
+
end
|
51
|
+
def self.style_text(text:, style:)
|
52
|
+
# formats the text according to the style we're looking to use
|
53
|
+
|
54
|
+
# Skips all styling
|
55
|
+
case style
|
56
|
+
when "title"
|
57
|
+
case @format
|
58
|
+
when "markdown"
|
59
|
+
"# #{text}"
|
60
|
+
when "slack"
|
61
|
+
"*#{text}*"
|
62
|
+
when "html"
|
63
|
+
"<h1>#{text}</h1>"
|
64
|
+
else
|
65
|
+
text
|
66
|
+
end
|
67
|
+
when "heading"
|
68
|
+
case @format
|
69
|
+
when "markdown"
|
70
|
+
"### #{text}"
|
71
|
+
when "slack"
|
72
|
+
"*#{text}*"
|
73
|
+
when "html"
|
74
|
+
"<h3>#{text}</h3>"
|
75
|
+
else
|
76
|
+
"#{text}:"
|
77
|
+
end
|
78
|
+
when "bold"
|
79
|
+
case @format
|
80
|
+
when "markdown"
|
81
|
+
"**#{text}**"
|
82
|
+
when "slack"
|
83
|
+
"*#{text}*"
|
84
|
+
when "html"
|
85
|
+
"<strong>#{text}</strong>"
|
86
|
+
else
|
87
|
+
text
|
88
|
+
end
|
89
|
+
else
|
90
|
+
text # catchall, shouldn't be needed
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.generate_message_with(issue:)
|
95
|
+
link = @jira_helper.url(issue: issue)
|
96
|
+
issue_type = issue.issuetype ? issue.issuetype.name : ''
|
97
|
+
status = issue.status.name
|
98
|
+
issue.attrs["fields"][:customfield_10040.to_s]
|
99
|
+
case @format
|
100
|
+
when "slack"
|
101
|
+
extra = @extra_fields.map { |key, value| ["", "*► #{key.to_s}*", issue.attrs["fields"][value.to_s]] }
|
102
|
+
[
|
103
|
+
"*► #{issue_type}: <#{link}|#{issue.summary}>* (#{status})",
|
104
|
+
issue.description,
|
105
|
+
extra.flatten!
|
106
|
+
]
|
107
|
+
.flatten!
|
108
|
+
.join(@format_line_break)
|
109
|
+
when "markdown"
|
110
|
+
extra = @extra_fields.map { |key, value| ["", "**► #{key.to_s}**", issue.attrs["fields"][value.to_s]] }
|
111
|
+
[
|
112
|
+
"**► #{issue_type}: [#{issue.summary}](#{link})** (#{status})",
|
113
|
+
issue.description,
|
114
|
+
extra.flatten!
|
115
|
+
]
|
116
|
+
.flatten!
|
117
|
+
.join(@format_line_break)
|
118
|
+
when "html"
|
119
|
+
extra = @extra_fields.map { |key, value| ["", "<strong>► #{key.to_s}</strong>", issue.attrs["fields"][value.to_s]] }
|
120
|
+
[
|
121
|
+
"<strong>► #{issue_type}: <a href=\"#{link}\" target=\"_blank\">#{issue.summary}</a></strong> (#{status})",
|
122
|
+
issue.description,
|
123
|
+
extra.flatten!
|
124
|
+
]
|
125
|
+
.flatten!
|
126
|
+
.join(@format_line_break)
|
127
|
+
else
|
128
|
+
extra = @extra_fields.map { |key, value| ["", "► #{key.to_s}", issue.attrs["fields"][value.to_s]] }
|
129
|
+
[
|
130
|
+
"► #{issue_type}: #{issue.summary}(#{status}) #{link}",
|
131
|
+
issue.description,
|
132
|
+
extra.flatten!
|
133
|
+
]
|
134
|
+
.flatten!
|
135
|
+
.join(@format_line_break)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def self.description
|
140
|
+
"It generates a release note based on the issues keys found in branch name and descriptions found in the commits"
|
141
|
+
end
|
142
|
+
|
143
|
+
def self.authors
|
144
|
+
["Erick Martins"]
|
145
|
+
end
|
146
|
+
|
147
|
+
def self.return_value
|
148
|
+
# If your method provides a return value, you can describe here what it does
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.details
|
152
|
+
# Optional:
|
153
|
+
"It generates a release note based on the issues keys found in branch name and descriptions found in the commits"
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.available_options
|
157
|
+
[
|
158
|
+
FastlaneCore::ConfigItem.new(
|
159
|
+
key: :ticket_prefix,
|
160
|
+
env_name: 'FL_FIND_TICKETS_MATCHING',
|
161
|
+
description: 'regex to extract ticket numbers',
|
162
|
+
default_value: '[A-Z]+',
|
163
|
+
optional: true
|
164
|
+
),
|
165
|
+
FastlaneCore::ConfigItem.new(
|
166
|
+
key: :format,
|
167
|
+
description: "You can use either markdown, slack, html or plain",
|
168
|
+
default_value: "markdown",
|
169
|
+
optional: true,
|
170
|
+
verify_block: proc do |value|
|
171
|
+
UI.user_error!("Invalid format! You can use either markdown, slack, html or plain") unless ['markdown', 'html', 'slack', 'plain'].include?(value)
|
172
|
+
end
|
173
|
+
),
|
174
|
+
FastlaneCore::ConfigItem.new(
|
175
|
+
key: :extra_fields,
|
176
|
+
description: "Extra jira fields",
|
177
|
+
type: Hash,
|
178
|
+
optional: true,
|
179
|
+
default_value: {},
|
180
|
+
),
|
181
|
+
|
182
|
+
# Jira Client options
|
183
|
+
FastlaneCore::ConfigItem.new(
|
184
|
+
key: :username,
|
185
|
+
env_name: 'FL_JIRA_USERNAME',
|
186
|
+
description: 'Jira user',
|
187
|
+
optional: false
|
188
|
+
),
|
189
|
+
FastlaneCore::ConfigItem.new(
|
190
|
+
key: :password,
|
191
|
+
env_name: 'FL_JIRA_PASSWORD',
|
192
|
+
description: 'Jira user',
|
193
|
+
optional: false
|
194
|
+
),
|
195
|
+
FastlaneCore::ConfigItem.new(
|
196
|
+
key: :host,
|
197
|
+
env_name: 'FL_JIRA_HOST',
|
198
|
+
description: 'Jira location',
|
199
|
+
optional: false
|
200
|
+
),
|
201
|
+
FastlaneCore::ConfigItem.new(
|
202
|
+
key: :context_path,
|
203
|
+
env_name: 'FL_JIRA_CONTEXT_PATH',
|
204
|
+
description: 'Jira context path',
|
205
|
+
optional: true,
|
206
|
+
default_value: ''
|
207
|
+
),
|
208
|
+
FastlaneCore::ConfigItem.new(
|
209
|
+
key: :disable_ssl_verification,
|
210
|
+
env_name: 'FL_JIRA_DISABLE_SSL_VERIFICATION',
|
211
|
+
description: 'Jira SSL Verification mode',
|
212
|
+
optional: true,
|
213
|
+
default_value: false,
|
214
|
+
type: Boolean
|
215
|
+
),
|
216
|
+
FastlaneCore::ConfigItem.new(
|
217
|
+
key: :debug,
|
218
|
+
description: "True if you want to log out a debug info",
|
219
|
+
default_value: false,
|
220
|
+
type: Boolean,
|
221
|
+
optional: true
|
222
|
+
)
|
223
|
+
]
|
224
|
+
end
|
225
|
+
|
226
|
+
def self.is_supported?(platform)
|
227
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
228
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
229
|
+
#
|
230
|
+
# [:ios, :mac, :android].include?(platform)
|
231
|
+
true
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
data/lib/fastlane/plugin/jira_issues_release_notes/actions/jira_issues_release_notes_action.rb
CHANGED
@@ -27,6 +27,10 @@ module Fastlane
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.run(params)
|
30
|
+
|
31
|
+
@format = params[:format]
|
32
|
+
@format_line_break = @format === 'html' ? '<br />' : "\n"
|
33
|
+
|
30
34
|
tag = get_last_tag(
|
31
35
|
match: params[:tag_prefix],
|
32
36
|
debug: params[:debug]
|
@@ -80,49 +84,55 @@ module Fastlane
|
|
80
84
|
to_validate = issues.select { |issue| params[:to_validate_status].include?(issue.status.name) }
|
81
85
|
validated = issues.select { |issue| params[:validated_status].include?(issue.status.name) }
|
82
86
|
|
83
|
-
generate_changelog(to_validate: to_validate, validated: validated
|
87
|
+
generate_changelog(to_validate: to_validate, validated: validated)
|
84
88
|
end
|
85
89
|
|
86
|
-
def self.generate_changelog(to_validate:, validated
|
90
|
+
def self.generate_changelog(to_validate:, validated:)
|
87
91
|
changelog = []
|
88
|
-
changelog.concat(format_issues(label: 'Tasks to validate', issues: to_validate
|
92
|
+
changelog.concat(format_issues(label: 'Tasks to validate', issues: to_validate)) unless to_validate.empty?
|
89
93
|
changelog.concat(['']) unless changelog.to_s.empty?
|
90
|
-
changelog.concat(format_issues(label: 'Validated tasks', issues: validated
|
94
|
+
changelog.concat(format_issues(label: 'Validated tasks', issues: validated)) unless validated.empty?
|
91
95
|
# changes = format_issues(issues: issues)
|
92
96
|
changelog = ['No changes included.'] if changelog.to_s.empty?
|
93
97
|
|
94
|
-
changelog.join(
|
98
|
+
changelog.join(@format_line_break)
|
95
99
|
end
|
96
100
|
|
97
|
-
def self.style_text(text:,
|
101
|
+
def self.style_text(text:, style:)
|
98
102
|
# formats the text according to the style we're looking to use
|
99
103
|
|
100
104
|
# Skips all styling
|
101
105
|
case style
|
102
106
|
when "title"
|
103
|
-
case format
|
107
|
+
case @format
|
104
108
|
when "markdown"
|
105
109
|
"# #{text}"
|
106
110
|
when "slack"
|
107
111
|
"*#{text}*"
|
112
|
+
when "html"
|
113
|
+
"<h1>#{text}</h1>"
|
108
114
|
else
|
109
115
|
text
|
110
116
|
end
|
111
117
|
when "heading"
|
112
|
-
case format
|
118
|
+
case @format
|
113
119
|
when "markdown"
|
114
120
|
"### #{text}"
|
115
121
|
when "slack"
|
116
122
|
"*#{text}*"
|
123
|
+
when "html"
|
124
|
+
"<h3>#{text}</h3>"
|
117
125
|
else
|
118
126
|
"#{text}:"
|
119
127
|
end
|
120
128
|
when "bold"
|
121
|
-
case format
|
129
|
+
case @format
|
122
130
|
when "markdown"
|
123
131
|
"**#{text}**"
|
124
132
|
when "slack"
|
125
133
|
"*#{text}*"
|
134
|
+
when "html"
|
135
|
+
"<strong>#{text}</strong>"
|
126
136
|
else
|
127
137
|
text
|
128
138
|
end
|
@@ -131,23 +141,25 @@ module Fastlane
|
|
131
141
|
end
|
132
142
|
end
|
133
143
|
|
134
|
-
def self.format_issue_link(issue
|
144
|
+
def self.format_issue_link(issue:)
|
135
145
|
# formats the link according to the output format we need
|
136
|
-
|
137
|
-
case format
|
146
|
+
link = @jira_helper.url(issue: issue)
|
147
|
+
case @format
|
138
148
|
when "slack"
|
139
|
-
"*<#{
|
149
|
+
"*<#{link}|#{issue.key}>*: #{issue.summary}"
|
140
150
|
when "markdown"
|
141
|
-
"- **[#{issue.key}](#{
|
151
|
+
"- **[#{issue.key}](#{link})**: #{issue.summary}"
|
152
|
+
when "html"
|
153
|
+
" - <strong><a href=\"#{link}\" target=\"_blank\">#{issue.key}</a><strong>: #{issue.summary}"
|
142
154
|
else
|
143
|
-
"- #{issue.key}: #{issue.summary} (#{
|
155
|
+
"- #{issue.key}: #{issue.summary} (#{link})"
|
144
156
|
end
|
145
157
|
end
|
146
158
|
|
147
|
-
def self.format_issues(label:, issues
|
159
|
+
def self.format_issues(label:, issues:)
|
148
160
|
[
|
149
|
-
style_text(text: "► #{label}", style: 'heading'
|
150
|
-
issues.map { |issue| format_issue_link(issue: issue
|
161
|
+
style_text(text: "► #{label}", style: 'heading'),
|
162
|
+
issues.map { |issue| format_issue_link(issue: issue) }
|
151
163
|
].flatten!
|
152
164
|
end
|
153
165
|
|
@@ -197,13 +209,6 @@ module Fastlane
|
|
197
209
|
description: "To parse version number from tag name",
|
198
210
|
default_value: '\d+\.\d+\.\d+'
|
199
211
|
),
|
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
212
|
FastlaneCore::ConfigItem.new(
|
208
213
|
key: :validated_status,
|
209
214
|
env_name: 'FL_JIRA_VALIDATED_STATUS',
|
@@ -220,11 +225,11 @@ module Fastlane
|
|
220
225
|
),
|
221
226
|
FastlaneCore::ConfigItem.new(
|
222
227
|
key: :format,
|
223
|
-
description: "You can use either markdown, slack or plain",
|
228
|
+
description: "You can use either markdown, slack, html or plain",
|
224
229
|
default_value: "markdown",
|
225
230
|
optional: true,
|
226
231
|
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)
|
232
|
+
UI.user_error!("Invalid format! You can use either markdown, slack, html or plain") unless ['markdown', 'html', 'slack', 'plain'].include?(value)
|
228
233
|
end
|
229
234
|
),
|
230
235
|
|
@@ -238,7 +243,7 @@ module Fastlane
|
|
238
243
|
FastlaneCore::ConfigItem.new(
|
239
244
|
key: :password,
|
240
245
|
env_name: 'FL_JIRA_PASSWORD',
|
241
|
-
description: 'Jira user',
|
246
|
+
description: 'Jira user password',
|
242
247
|
optional: false
|
243
248
|
),
|
244
249
|
FastlaneCore::ConfigItem.new(
|
data/lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb
CHANGED
@@ -61,11 +61,14 @@ module Fastlane
|
|
61
61
|
@client = jira_client_helper
|
62
62
|
end
|
63
63
|
|
64
|
-
def get(issues:)
|
64
|
+
def get(issues:, extra_fields: [])
|
65
65
|
return [] if issues.to_a.empty?
|
66
66
|
|
67
|
+
fields = [:key, :summary, :status, :issuetype, :description]
|
68
|
+
fields.concat extra_fields
|
69
|
+
|
67
70
|
begin
|
68
|
-
@client.Issue.jql("KEY IN (#{issues.join(',')})", fields:
|
71
|
+
@client.Issue.jql("KEY IN (#{issues.join(',')})", fields: fields, validate_query: false)
|
69
72
|
rescue StandardError => e
|
70
73
|
UI.important('Jira Client: Failed to get issue.')
|
71
74
|
UI.important("Jira Client: Reason - #{e.message}")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.
|
4
|
+
version: 0.4.0
|
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-
|
11
|
+
date: 2021-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jira-ruby
|
@@ -159,6 +159,7 @@ 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
|
162
163
|
- lib/fastlane/plugin/jira_issues_release_notes/actions/jira_issues_release_notes_action.rb
|
163
164
|
- lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb
|
164
165
|
- lib/fastlane/plugin/jira_issues_release_notes/version.rb
|