fastlane-plugin-jira_issues_release_notes 0.3.5 → 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 +21 -23
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/branch_jira_issues_release_notes_action.rb +23 -8
- data/lib/fastlane/plugin/jira_issues_release_notes/actions/jira_issues_release_notes_action.rb +32 -20
- data/lib/fastlane/plugin/jira_issues_release_notes/version.rb +1 -1
- metadata +1 -1
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
@@ -4,6 +4,10 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
It generates a release note based on the issues keys and descriptions found in the commits and branch name
|
8
|
+
|
9
|
+
|
10
|
+
|
7
11
|
## Getting Started
|
8
12
|
|
9
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:
|
@@ -14,15 +18,9 @@ fastlane add_plugin jira_issues_release_notes
|
|
14
18
|
|
15
19
|
|
16
20
|
|
17
|
-
## About jira_issues_release_notes
|
18
|
-
|
19
|
-
It generates a release note based on the issues keys and descriptions found in the commits.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
21
|
## Actions
|
24
22
|
|
25
|
-
All actions requires some
|
23
|
+
All actions requires some parameters to access Jira API.
|
26
24
|
**These are the arguments the all share:**
|
27
25
|
|
28
26
|
| Argument | Type | Description | Optional | Default | Env Name |
|
@@ -37,17 +35,17 @@ All actions requires some parameter to access Jira API.
|
|
37
35
|
|
38
36
|
### branch_jira_issues_release_notes
|
39
37
|
|
40
|
-
This action creates a
|
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.
|
41
39
|
|
42
|
-
It should be used to generate version to validate you branch's feature before
|
40
|
+
It should be used to generate version to validate you branch's feature before you merge it.
|
43
41
|
|
44
42
|
**Arguments:**
|
45
43
|
|
46
|
-
| Argument | Type
|
47
|
-
| ------------- |
|
48
|
-
| ticket_prefix | `String` or `Regex`
|
49
|
-
| extra_fields | `Hash`
|
50
|
-
| format | `slack`, `markdown` or `plain` | Defines the result format | ✓ | `markdown` | |
|
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` | |
|
51
49
|
|
52
50
|
**Usage example:**
|
53
51
|
|
@@ -100,7 +98,7 @@ platform :android do
|
|
100
98
|
link_to_download = upload_to_s3
|
101
99
|
|
102
100
|
release_notes = jira_issues_release_notes(
|
103
|
-
tag_prefix: '
|
101
|
+
tag_prefix: 'v*',
|
104
102
|
ticket_prefix: 'ABC',
|
105
103
|
username: ENV["FL_JIRA_USERNAME"],
|
106
104
|
password: ENV["FL_JIRA_PASSWORD"],
|
@@ -123,14 +121,14 @@ end
|
|
123
121
|
|
124
122
|
**Arguments:**
|
125
123
|
|
126
|
-
| Argument | Type
|
127
|
-
| ------------------ |
|
128
|
-
| tag_prefix | `Regex`
|
129
|
-
| ticket_prefix | `String` or `Regex`
|
130
|
-
| tag_version_match | `String`
|
131
|
-
| validated_status | `Array`
|
132
|
-
| to_validate_status | `Array`
|
133
|
-
| format | `slack`, `markdown` or `plain` | Defines the result format
|
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` | |
|
134
132
|
|
135
133
|
|
136
134
|
|
@@ -10,6 +10,7 @@ module Fastlane
|
|
10
10
|
|
11
11
|
@format = params[:format]
|
12
12
|
@extra_fields = params[:extra_fields]
|
13
|
+
@format_line_break = @format === 'html' ? '<br />' : "\n"
|
13
14
|
|
14
15
|
ticket_code = regex.match branch
|
15
16
|
|
@@ -47,7 +48,6 @@ module Fastlane
|
|
47
48
|
last_commit[:message]
|
48
49
|
].join("\n")
|
49
50
|
end
|
50
|
-
|
51
51
|
def self.style_text(text:, style:)
|
52
52
|
# formats the text according to the style we're looking to use
|
53
53
|
|
@@ -59,24 +59,30 @@ module Fastlane
|
|
59
59
|
"# #{text}"
|
60
60
|
when "slack"
|
61
61
|
"*#{text}*"
|
62
|
+
when "html"
|
63
|
+
"<h1>#{text}</h1>"
|
62
64
|
else
|
63
65
|
text
|
64
66
|
end
|
65
67
|
when "heading"
|
66
|
-
case format
|
68
|
+
case @format
|
67
69
|
when "markdown"
|
68
70
|
"### #{text}"
|
69
71
|
when "slack"
|
70
72
|
"*#{text}*"
|
73
|
+
when "html"
|
74
|
+
"<h3>#{text}</h3>"
|
71
75
|
else
|
72
76
|
"#{text}:"
|
73
77
|
end
|
74
78
|
when "bold"
|
75
|
-
case format
|
79
|
+
case @format
|
76
80
|
when "markdown"
|
77
81
|
"**#{text}**"
|
78
82
|
when "slack"
|
79
83
|
"*#{text}*"
|
84
|
+
when "html"
|
85
|
+
"<strong>#{text}</strong>"
|
80
86
|
else
|
81
87
|
text
|
82
88
|
end
|
@@ -99,7 +105,7 @@ module Fastlane
|
|
99
105
|
extra.flatten!
|
100
106
|
]
|
101
107
|
.flatten!
|
102
|
-
.join(
|
108
|
+
.join(@format_line_break)
|
103
109
|
when "markdown"
|
104
110
|
extra = @extra_fields.map { |key, value| ["", "**► #{key.to_s}**", issue.attrs["fields"][value.to_s]] }
|
105
111
|
[
|
@@ -108,7 +114,16 @@ module Fastlane
|
|
108
114
|
extra.flatten!
|
109
115
|
]
|
110
116
|
.flatten!
|
111
|
-
.join(
|
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)
|
112
127
|
else
|
113
128
|
extra = @extra_fields.map { |key, value| ["", "► #{key.to_s}", issue.attrs["fields"][value.to_s]] }
|
114
129
|
[
|
@@ -117,7 +132,7 @@ module Fastlane
|
|
117
132
|
extra.flatten!
|
118
133
|
]
|
119
134
|
.flatten!
|
120
|
-
.join(
|
135
|
+
.join(@format_line_break)
|
121
136
|
end
|
122
137
|
end
|
123
138
|
|
@@ -149,11 +164,11 @@ module Fastlane
|
|
149
164
|
),
|
150
165
|
FastlaneCore::ConfigItem.new(
|
151
166
|
key: :format,
|
152
|
-
description: "You can use either markdown, slack or plain",
|
167
|
+
description: "You can use either markdown, slack, html or plain",
|
153
168
|
default_value: "markdown",
|
154
169
|
optional: true,
|
155
170
|
verify_block: proc do |value|
|
156
|
-
UI.user_error!("Invalid format! You can use either markdown, slack or plain") unless ['markdown', 'slack', 'plain'].include?(value)
|
171
|
+
UI.user_error!("Invalid format! You can use either markdown, slack, html or plain") unless ['markdown', 'html', 'slack', 'plain'].include?(value)
|
157
172
|
end
|
158
173
|
),
|
159
174
|
FastlaneCore::ConfigItem.new(
|
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
|
|
@@ -213,11 +225,11 @@ module Fastlane
|
|
213
225
|
),
|
214
226
|
FastlaneCore::ConfigItem.new(
|
215
227
|
key: :format,
|
216
|
-
description: "You can use either markdown, slack or plain",
|
228
|
+
description: "You can use either markdown, slack, html or plain",
|
217
229
|
default_value: "markdown",
|
218
230
|
optional: true,
|
219
231
|
verify_block: proc do |value|
|
220
|
-
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)
|
221
233
|
end
|
222
234
|
),
|
223
235
|
|