diff options
author | The Bundler Bot <bot@bundler.io> | 2017-02-09 06:23:56 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-02-09 06:23:56 +0000 |
commit | cfd66c99a10ac218bb6b8c2ef07659d5e347b41c (patch) | |
tree | 100378487ee0742664338ec09fd7d3e9785f842c /task | |
parent | 74341aaaa949e914cd1cffb163cd99bdf14b91df (diff) | |
parent | 03c8f40ee7813c642620dd10cdc686d6a990c26c (diff) | |
download | bundler-cfd66c99a10ac218bb6b8c2ef07659d5e347b41c.tar.gz |
Auto merge of #5414 - bundler:seg-patch-release-milestone, r=segiddins
[Release] Pull PRs to backport from GH milestone
Diffstat (limited to 'task')
-rw-r--r-- | task/release.rake | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/task/release.rake b/task/release.rake index c15c312994..03f1fd617d 100644 --- a/task/release.rake +++ b/task/release.rake @@ -10,10 +10,18 @@ namespace :release do abort end - desc "Make a patch release with the specified PRs from master" + def gh_api_request(opts) + require "net/http" + require "json" + host = opts.fetch(:host) { "https://api.github.com/" } + path = opts.fetch(:path) + response = Net::HTTP.get(URI.join(host, path)) + JSON.parse(response) + end + + desc "Make a patch release with the PRs from master in the patch milestone" task :patch, :version do |_t, args| version = args.version - prs = args.extras version ||= begin version = BUNDLER_SPEC.version @@ -28,6 +36,18 @@ namespace :release do confirm "You are about to release #{version}, currently #{BUNDLER_SPEC.version}" + milestones = gh_api_request(:path => "repos/bundler/bundler/milestones?state=open") + unless patch_milestone = milestones.find {|m| m["title"] == version } + abort "failed to find #{version} milestone on GitHub" + end + prs = gh_api_request(:path => "repos/bundler/bundler/pulls?milestone=#{patch_milestone["number"]}") + prs.map! do |pr| + unless pr["merged_at"] + abort "https://github.com/bundler/bundler/pull/#{pr["number"]} hasn't been merged yet!" + end + pr["number"] + end + version_file = "lib/bundler/version.rb" version_contents = File.read(version_file) unless version_contents.sub!(/^(\s*VERSION = )"#{Gem::Version::VERSION_PATTERN}"/, "\\1#{version.to_s.dump}") |