mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 16:28:08 +01:00
Change output format of repo:changelog
task (#31546)
This commit is contained in:
parent
62be0234d5
commit
c493689e84
1 changed files with 20 additions and 12 deletions
|
@ -49,8 +49,11 @@ namespace :repo do
|
|||
File.open(path, 'r') do |file|
|
||||
file.each_line do |line|
|
||||
if line.start_with?('-')
|
||||
new_line = line.gsub(/[(]#([[:digit:]]+)[)]\Z/) do |pull_request_reference|
|
||||
pull_request_number = pull_request_reference[2..-2]
|
||||
new_line = line.gsub(/\(#([[:digit:]]+)(, #([[:digit:]]+))*\)\Z/) do |pull_requests_string|
|
||||
pull_requests = pull_requests_string[1...-1].split(',').map { |pr_id| pr_id.strip[1...] }
|
||||
response = nil
|
||||
|
||||
authors = pull_requests.map do |pull_request_number|
|
||||
response = nil
|
||||
|
||||
loop do
|
||||
|
@ -66,7 +69,12 @@ namespace :repo do
|
|||
end
|
||||
|
||||
pull_request = Oj.load(response.to_s)
|
||||
"([#{pull_request['user']['login']}](#{pull_request['html_url']}))"
|
||||
pull_request['user']['login']
|
||||
end
|
||||
|
||||
authors.sort!.uniq!
|
||||
|
||||
"(#{pull_requests.map { |pr| "##{pr}" }.to_sentence} by #{authors.map { |author| "@#{author}" }.to_sentence})"
|
||||
end
|
||||
|
||||
tmp.puts new_line
|
||||
|
|
Loading…
Reference in a new issue