working code
This commit is contained in:
parent
8c9b7f8721
commit
4ac3461c05
|
@ -6,6 +6,9 @@ require 'json'
|
||||||
|
|
||||||
@project_path = '/Users/petrkorolev/repo/ActionSheetPicker-3.0'
|
@project_path = '/Users/petrkorolev/repo/ActionSheetPicker-3.0'
|
||||||
|
|
||||||
|
@github_user = 'skywinder'
|
||||||
|
@github_repo_name = 'ActionSheetPicker-3.0'
|
||||||
|
|
||||||
tag1 = '1.1.21'
|
tag1 = '1.1.21'
|
||||||
tag2 = '1.2.0'
|
tag2 = '1.2.0'
|
||||||
|
|
||||||
|
@ -24,15 +27,13 @@ def findTagsDates(tag1, tag2)
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
re = /(.*)\s\(.*\)/m
|
|
||||||
match_result = re.match(value1)
|
|
||||||
|
|
||||||
unless match_result
|
unless /(.*)\s\(.*\)/.match(value1)[1]
|
||||||
puts 'Not found any versions'
|
puts 'Not found any versions'
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
time = Time.parse(match_result[1])
|
time = Time.parse(/(.*)\s\(.*\)/.match(value1)[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
def getAllClosedPullRequests
|
def getAllClosedPullRequests
|
||||||
|
@ -48,6 +49,24 @@ def getAllClosedPullRequests
|
||||||
json
|
json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def compund_changelog (tag_time, pull_requests)
|
||||||
|
log = ''
|
||||||
|
last_tag = exec_command('git describe --abbrev=0 --tags').strip
|
||||||
|
log += "## [#{last_tag}] (https://github.com/#{@github_user}/#{@github_repo_name}/tree/#{last_tag})\n"
|
||||||
|
time_string = tag_time.strftime "%Y/%m/%d"
|
||||||
|
log += "#### #{time_string}\n"
|
||||||
|
|
||||||
|
pull_requests.each { |dict|
|
||||||
|
merge = "#{dict[:title]} (##{dict[:number]})\n"
|
||||||
|
log += "- #{merge}"
|
||||||
|
}
|
||||||
|
|
||||||
|
puts log
|
||||||
|
File.open('output.txt', 'w') { |file| file.write(log) }
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
tag_time = findTagsDates tag1, tag2
|
tag_time = findTagsDates tag1, tag2
|
||||||
|
|
||||||
pull_requests = getAllClosedPullRequests
|
pull_requests = getAllClosedPullRequests
|
||||||
|
@ -57,7 +76,5 @@ pull_requests.delete_if { |req|
|
||||||
t < tag_time
|
t < tag_time
|
||||||
}
|
}
|
||||||
|
|
||||||
pull_requests.each { |dict|
|
|
||||||
# print_json dict
|
compund_changelog(tag_time, pull_requests)
|
||||||
puts "##{dict[:number]} - #{dict[:title]} (#{dict[:closed_at]})"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user