Skip to content

Commit 71d8eb6

Browse files
authored
Add link to issue in generating release notes (#562)
* add link if comment has issue number * add a comment
1 parent 915e75d commit 71d8eb6

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

Rakefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ end
176176
desc 'Update release notes'
177177
task :notes do
178178
tag_sort = ->(tag1, tag2) do
179-
tag1_numbers = tag1.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map! { |n| n.to_i }
180-
tag2_numbers = tag2.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map! { |n| n.to_i }
179+
tag1_numbers = tag1.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map!(&:to_i)
180+
tag2_numbers = tag2.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map!(&:to_i)
181181
tag1_numbers <=> tag2_numbers
182182
end
183183

@@ -213,7 +213,16 @@ task :notes do
213213
# use first 7 chars to match GitHub
214214
comment = line.gsub(hex, '').strip
215215
next if comment == 'Update release notes'
216-
new_data += "- [#{hex[0...7]}](https://github.com/appium/#{gh_name}/commit/#{hex}) #{comment}\n"
216+
217+
issue_num = comment.slice(/\(#[0-9]+\)/)
218+
# If the issue_num is pull request, GitHub redirects to the pull request.
219+
comment_note = if issue_num
220+
issue_num.gsub!(/[(#)]/, '')
221+
"[#{comment}](https://github.com/appium/#{gh_name}/issues/#{issue_num})"
222+
else
223+
comment
224+
end
225+
new_data += "- [#{hex[0...7]}](https://github.com/appium/#{gh_name}/commit/#{hex}) #{comment_note}\n"
217226
end
218227
data = new_data + "\n"
219228

0 commit comments

Comments
 (0)