Sha256: 0b09a7533fa54ac17dc23f83ff6fe42c80ea78a4a607c5f6cea8e33bb2648a43
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 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 "Add or remove labels on a set of pull requests." opt :prs, "The list of PRs to label", :type => :strings, :required => true opt :add, "Labels to add", :type => :strings opt :remove, "Labels to remove", :type => :strings opt :comment, "Comment explaining the label change", :type => :string MultiRepo::CLI.common_options(self, :only => :dry_run) end Optimist.die "at least one of --add or --remove is required" unless opts[:add_given] || opts[:remove_given] 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}") github.add_labels_to_an_issue(repo_name, pr_number, opts[:add]) if opts[:add].present? github.remove_labels_from_an_issue(repo_name, pr_number, opts[:remove]) if opts[:remove].present? github.add_comment(repo_name, pr_number, opts[:comment]) if opts[:comment].present? puts end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multi_repo-0.5.0 | scripts/pull_request_labeler |