Added helper script for generate github releases

This commit is contained in:
Hiroshi SHIBATA 2023-02-09 18:52:51 +09:00
Родитель 728d2f808e
Коммит 5991af204c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
1 изменённых файлов: 40 добавлений и 0 удалений

40
tool/gen-github-release.rb Executable file
Просмотреть файл

@ -0,0 +1,40 @@
#!/usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "octokit"
gem "faraday-retry"
gem "nokogiri"
end
require "open-uri"
Octokit.configure do |c|
c.access_token = ENV['GITHUB_TOKEN']
c.auto_paginate = true
c.per_page = 100
end
client = Octokit::Client.new
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}"
title = Nokogiri::HTML(URI.open(url)).title
title.gsub!(/ - Ruby master - Ruby Issue Tracking System/, "")
end
if c[:commit][:message] =~ /\(#(\d*)\)/
url = "https://github.com/ruby/ruby/pull/#{$1}"
title = Nokogiri::HTML(URI.open(url)).title
title.gsub!(/ · ruby\/ruby · GitHub/, "")
end
next unless url && title
puts "* [#{title}](#{url})"
end