Rakefile in rbs-3.1.3 vs Rakefile in rbs-3.2.0.pre.1
- old
+ new
@@ -308,5 +308,49 @@
if status.success?
puts " >> Done! Open #{output.chomp} and publish the release!"
end
end
end
+
+
+desc "Generate changelog template from GH pull requests"
+task :changelog do
+ major, minor, patch, pre = RBS::VERSION.split(".", 4)
+ major = major.to_i
+ minor = minor.to_i
+ patch = patch.to_i
+
+ if patch == 0
+ milestone = "RBS #{major}.#{minor}"
+ else
+ milestone = "RBS #{major}.#{minor}.x"
+ end
+
+ puts "🔍 Finding pull requests that is associated to milestone `#{milestone}`..."
+
+ command = [
+ "gh",
+ "pr",
+ "list",
+ "--limit=10000",
+ "--json",
+ "url,title,number",
+ "--search" ,
+ "milestone:\"#{milestone}\" is:merged sort:updated-desc -label:Released"
+ ]
+
+ require "open3"
+ output, status = Open3.capture2(*command)
+ raise status.inspect unless status.success?
+
+ require "json"
+ json = JSON.parse(output, symbolize_names: true)
+
+ unless json.empty?
+ puts
+ json.each do |line|
+ puts "* #{line[:title]} ([##{line[:number]}](#{line[:url]}))"
+ end
+ else
+ puts " (🤑 There is no *unreleased* pull request associated to the milestone.)"
+ end
+end