summaryrefslogtreecommitdiff
path: root/tool/gen-github-release.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/gen-github-release.rb')
-rwxr-xr-xtool/gen-github-release.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/tool/gen-github-release.rb b/tool/gen-github-release.rb
index 4d8c2910f4..cdb66080d9 100755
--- a/tool/gen-github-release.rb
+++ b/tool/gen-github-release.rb
@@ -27,10 +27,12 @@ client = Octokit::Client.new
note = "## What's Changed\n\n"
+notes = []
+
diff = client.compare("ruby/ruby", ARGV[0], ARGV[1])
diff[:commits].each do |c|
- if c[:commit][:message] =~ /\[Backport #(\d*)\]/
- url = "https://bugs.ruby-lang.org/issues/#{$1}"
+ if c[:commit][:message] =~ /\[(Backport|Feature|Bug) #(\d*)\]/
+ url = "https://bugs.ruby-lang.org/issues/#{$2}"
title = Nokogiri::HTML(URI.open(url)).title
title.gsub!(/ - Ruby master - Ruby Issue Tracking System/, "")
elsif c[:commit][:message] =~ /\(#(\d*)\)/
@@ -40,19 +42,24 @@ diff[:commits].each do |c|
else
next
end
- note << "* [#{title}](#{url})\n"
+ notes << "* [#{title}](#{url})"
rescue OpenURI::HTTPError
puts "Error: #{url}"
end
-note << "\n"
+notes.uniq!
+
+note << notes.join("\n")
+
+note << "\n\n"
note << "Note: This list is automatically generated by tool/gen-github-release.rb. Because of this, some commits may be missing.\n\n"
note << "## Full Changelog\n\n"
note << "https://github.com/ruby/ruby/compare/#{ARGV[0]}...#{ARGV[1]}\n\n"
if ARGV[2] == "--no-dry-run"
- name = ARGV[1].gsub(/v/, "").gsub(/_/, ".")
- client.create_release("ruby/ruby", ARGV[1], name: name, body: note)
+ name = ARGV[1].gsub(/^v/, "").gsub(/_/, ".")
+ prerelease = ARGV[1].match?(/rc|preview/) ? true : false
+ client.create_release("ruby/ruby", ARGV[1], name: name, body: note, make_latest: "false", prerelease: prerelease)
puts "Created a release: https://github.com/ruby/ruby/releases/tag/#{ARGV[1]}"
else
puts note