Sha256: dfc0499b31bc7d8b9899783fb2bd647fab11c2177040f540bc1045623be477a5
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
#!/usr/bin/env ruby require "bundler/inline" gemfile do source "https://rubygems.org" gem "multi_repo", require: "multi_repo/cli", path: File.expand_path("..", __dir__) end opts = Optimist.options do synopsis "Merge a set of pull requests, also setting assignee and labels." opt :prs, "The list of PRs to merge", :type => :strings, :required => true opt :assignee, "GitHub user to assign when merging", :type => :string, :required => true opt :labels, "Labels to apply when merging", :type => :strings MultiRepo::CLI.common_options(self) end prs = begin MultiRepo::Service::Github.parse_prs(opts[:prs]) rescue ArgumentError => err Optimist.die :prs, err.message end github = MultiRepo::Service::Github.new(:dry_run => opts[:dry_run]) prs.each do |repo_name, pr_number| puts MultiRepo::CLI.header("#{repo_name}##{pr_number}") begin github.merge_pull_request(repo_name, pr_number) rescue Octokit::MethodNotAllowed => err raise unless err.to_s.include?("Pull Request is not mergeable") puts "** WARN: Pull Request is not mergeable".light_yellow end github.add_labels_to_an_issue(repo_name, pr_number, opts[:labels]) if opts[:labels].present? github.assign_user(repo_name, pr_number, opts[:assignee]) puts end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multi_repo-0.5.0 | scripts/pull_request_merger |