forked from jruby-gradle/jruby-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
changelog.rb
37 lines (27 loc) · 877 Bytes
/
changelog.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env ruby
require 'json'
require 'net/https'
require 'uri'
def uri_for(project, milestone)
return URI("https://api.github.com/repos/jruby-gradle/#{project}/issues?state=closed&milestone=#{milestone}")
end
def changelog_for(project, milestone)
uri = uri_for(project, milestone)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
response = http.get(uri.request_uri)
raise "Status #{response.code}" unless response.code.to_i == 200
body = JSON.parse(response.body)
body.reverse.each do |issue|
puts "* [##{issue['number']}](#{issue['html_url']}) - #{issue['title']}"
end
end
print 'What project? > '
project = STDIN.gets.chomp
print 'What milestone? > '
milestone = STDIN.gets.chomp
puts
puts "Computing changelog for '#{project}' and milestone '#{milestone}'"
puts
puts '-------------------'
changelog_for(project, milestone)