circleci-bundle-update-pr 1.9.1 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1d92f8cd11f20a795228b31634a9b9438e43737b926b8ce375e09e36143b9da
4
- data.tar.gz: 4964a2668e8124b9b2421893419c3b83c95639b279539b4dd2073ab99a8134dd
3
+ metadata.gz: 810482472816d5a97508a3427b3c62ef710ef073a045537a109578fe5f42e03f
4
+ data.tar.gz: 500887eca1eac3aafa52596c61ad1e6e432c6d99030b38903762609e34b54b51
5
5
  SHA512:
6
- metadata.gz: 2e665445e3504a1ea055578ad11025ec05fa380c4feade2ca3ec5b1a60ed50f1e7be9f95fb642a96abf33183cbfca43ca7f90968306d931585bb5ba6e9eaf392
7
- data.tar.gz: 4c240992f51d70d8a0a81a3a0d623065b2b9a9d139f0cf1a0725288c7ea01b439d35b9c41078ae99c71d045987453b0b8b415d71a99dc0d6d7f02582b86de2df
6
+ metadata.gz: 1c38298e4625d5bd50a9eae298ad118a3424ee7268ad242fac66518cded716a1c9d45ae98e2ba5dc12a2b6a20f6edc7c676dfad9ac9d383b5f41503d1d5e14b5
7
+ data.tar.gz: 45e87d4710a167a0495368b3939247c539be87d7f69852fc230ecb1e20bb147be7ef6d895f8e82d09a2c73ca297adef7db698e073dc8418aa31d0293a6a2128a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- circleci-bundle-update-pr (1.9.1)
4
+ circleci-bundle-update-pr (1.10.0)
5
5
  compare_linker (>= 1.4.0)
6
6
  octokit
7
7
 
@@ -102,6 +102,12 @@ By default, it works only on master branch, but you can also explicitly specify
102
102
  $ circleci-bundle-update-pr <git username> <git email address> master develop topic
103
103
  ```
104
104
 
105
+ You can assign the PR to any users.
106
+
107
+ ```
108
+ $ circleci-bundle-update-pr <git username> <git email address> -a alice,bob,carol
109
+ ```
110
+
105
111
  ## Contributing
106
112
 
107
113
  1. Fork it ( https://github.com/masutaka/circleci-bundle-update-pr/fork )
data/README.md CHANGED
@@ -109,6 +109,12 @@ By default, it works only on master branch, but you can also explicitly specify
109
109
  $ circleci-bundle-update-pr <git username> <git email address> master develop topic
110
110
  ```
111
111
 
112
+ You can assign the PR to any users.
113
+
114
+ ```
115
+ $ circleci-bundle-update-pr <git username> <git email address> -a alice,bob,carol
116
+ ```
117
+
112
118
  ## Contributing
113
119
 
114
120
  1. Fork it ( https://github.com/masutaka/circleci-bundle-update-pr/fork )
@@ -1,5 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "circleci/bundle/update/pr"
4
+ require 'optparse'
4
5
 
5
- Circleci::Bundle::Update::Pr.create_if_needed(git_username: ARGV.shift, git_email: ARGV.shift, git_branches: ARGV.empty? ? ["master"] : ARGV)
6
+ opt = OptionParser.new
7
+ options = { assignees: [] }
8
+ opt.on('-a', '--assignees alice,bob,carol', Array, 'Assign the PR to them') { |v| options[:assignees] = v }
9
+ opt.parse!(ARGV)
10
+
11
+ Circleci::Bundle::Update::Pr.create_if_needed(
12
+ git_username: ARGV.shift,
13
+ git_email: ARGV.shift,
14
+ git_branches: ARGV.empty? ? ["master"] : ARGV,
15
+ assignees: options[:assignees],
16
+ )
@@ -6,7 +6,7 @@ module Circleci
6
6
  module Bundle
7
7
  module Update
8
8
  module Pr
9
- def self.create_if_needed(git_username: nil, git_email: nil, git_branches: ["master"])
9
+ def self.create_if_needed(git_username: nil, git_email: nil, git_branches: ["master"], assignees: [])
10
10
  raise_if_env_unvalid!
11
11
  return unless need?(git_branches)
12
12
  repo_full_name = "#{ENV['CIRCLE_PROJECT_USERNAME']}/#{ENV['CIRCLE_PROJECT_REPONAME']}"
@@ -19,6 +19,7 @@ module Circleci
19
19
  create_branch(git_username, git_email, branch, repo_full_name)
20
20
  pull_request = create_pull_request(repo_full_name, branch, now)
21
21
  add_comment_of_compare_linker(repo_full_name, pull_request[:number])
22
+ add_assignees(repo_full_name, pull_request[:number], assignees) unless assignees.empty?
22
23
  end
23
24
 
24
25
  def self.need?(git_branches)
@@ -66,6 +67,11 @@ Powered by [compare_linker](https://rubygems.org/gems/compare_linker)
66
67
  end
67
68
  private_class_method :add_comment_of_compare_linker
68
69
 
70
+ def self.add_assignees(repo_full_name, pr_number, assignees)
71
+ client.add_assignees(repo_full_name, pr_number, assignees)
72
+ end
73
+ private_class_method :add_assignees
74
+
69
75
  def self.client
70
76
  if enterprise?
71
77
  Octokit::Client.new(access_token: ENV['ENTERPRISE_OCTOKIT_ACCESS_TOKEN'],
@@ -2,7 +2,7 @@ module Circleci
2
2
  module Bundle
3
3
  module Update
4
4
  module Pr
5
- VERSION = "1.9.1"
5
+ VERSION = "1.10.0"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circleci-bundle-update-pr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Masuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-02 00:00:00.000000000 Z
11
+ date: 2018-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit