circleci-bundle-update-pr 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e50dd78098b429691a6337242fdee4ab41974be18904d58b6f9a5eedbdf74e0
4
- data.tar.gz: 36555ee2c44458ef2d456d2a5cf3c09b21e3b96908948aba0fa40819fb68f590
3
+ metadata.gz: 730944a68610db32ff05eed70a7679dd3eb435e6b70c5cd6a4e87a89635bbb45
4
+ data.tar.gz: e10e148aec42a589409f667a0a61acefc5d46025c4f78d1b608334d3eecabe55
5
5
  SHA512:
6
- metadata.gz: c01f59d3e28e132607892ca07d807478c01155032109a96689becdd18d17e758f09c884a0067fda08bc54a8a2cd8b3281cdbc30f84028dcd499f4139b762feba
7
- data.tar.gz: d253a28b14648fc6d42165eb0c59bcea01d1370ee675efb36f1f225c1c5396340799abd89c83dcac3695d6fac057398aa31e7dec67e3aabc8b27e4c82cebc2ef
6
+ metadata.gz: 81cca2a76b7348417a52bad36b610be96355cf0748ca5a8df095575dfd431b1ba6538bf8ac9c7c6ba38080a121f91dd3458268f0c607be3a484e8e170f3455ed
7
+ data.tar.gz: 587c1b13c5d72cab5c3fb5c11ddb2c18ece7f41c5767f8eeab5bbfc19a609c476b8b5e2718dc92db22914e551ae2989daacf86a90a5bf78d4eb46fec7df59511
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- circleci-bundle-update-pr (1.12.0)
4
+ circleci-bundle-update-pr (1.13.0)
5
5
  compare_linker (>= 1.4.0)
6
6
  octokit
7
7
 
data/README.md CHANGED
@@ -115,6 +115,7 @@ Usage: circleci-bundle-update-pr [options]
115
115
  -a, --assignees alice,bob,carol Assign the PR to them
116
116
  -r, --reviewers alice,bob,carol Request PR review to them
117
117
  -l, --labels "In Review, Update" Add labels to the PR
118
+ -d, --duplicate Make PR even if it has already existed
118
119
  ```
119
120
 
120
121
  ## Contributing
@@ -8,6 +8,7 @@ options = { assignees: [] }
8
8
  opt.on('-a', '--assignees alice,bob,carol', Array, 'Assign the PR to them') { |v| options[:assignees] = v.map(&:strip) }
9
9
  opt.on('-r', '--reviewers alice,bob,carol', Array, 'Request PR review to them') { |v| options[:reviewers] = v.map(&:strip) }
10
10
  opt.on('-l', '--labels "In Review, Update"', Array, 'Add labels to the PR') { |v| options[:labels] = v.map(&:strip) }
11
+ opt.on('-d', '--duplicate', 'Make PR even if it has already existed') { |v| options[:allow_dup_pr] = v }
11
12
  opt.parse!(ARGV)
12
13
 
13
14
  Circleci::Bundle::Update::Pr.create_if_needed(
@@ -17,4 +18,5 @@ Circleci::Bundle::Update::Pr.create_if_needed(
17
18
  assignees: options[:assignees],
18
19
  reviewers: options[:reviewers],
19
20
  labels: options[:labels],
21
+ allow_dup_pr: !!options[:allow_dup_pr]
20
22
  )
@@ -7,10 +7,10 @@ module Circleci
7
7
  module Update
8
8
  module Pr
9
9
  def self.create_if_needed(git_username: nil, git_email: nil, git_branches: ["master"],
10
- assignees: nil, reviewers: nil, labels: nil)
10
+ assignees: nil, reviewers: nil, labels: nil, allow_dup_pr: false)
11
11
  raise_if_env_unvalid!
12
12
 
13
- if skip?
13
+ if skip?(allow_dup_pr)
14
14
  puts 'Skip because it has already existed.'
15
15
  return
16
16
  end
@@ -47,15 +47,25 @@ module Circleci
47
47
  end
48
48
  private_class_method :raise_if_env_unvalid!
49
49
 
50
+ # Should skip to make PR?
51
+ #
52
+ # @param allow_dup_pr [Boolean]
53
+ # @return [Boolean]
54
+ def self.skip?(allow_dup_pr)
55
+ return false if allow_dup_pr
56
+ exists_bundle_update_pr?
57
+ end
58
+ private_class_method :skip?
59
+
50
60
  # Has 'bundle update PR' already existed?
51
61
  #
52
62
  # @return [Boolean]
53
- def self.skip?
63
+ def self.exists_bundle_update_pr?
54
64
  client.pull_requests(repo_full_name).find do |pr|
55
65
  pr.title =~ /\A#{TITLE_PREFIX}/ && pr.head.ref =~ /\A#{BRANCH_PREFIX}\d+/
56
66
  end != nil
57
67
  end
58
- private_class_method :skip?
68
+ private_class_method :exists_bundle_update_pr?
59
69
 
60
70
  # Does it need to commit due to bundle update?
61
71
  #
@@ -2,7 +2,7 @@ module Circleci
2
2
  module Bundle
3
3
  module Update
4
4
  module Pr
5
- VERSION = "1.12.0"
5
+ VERSION = "1.13.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.12.0
4
+ version: 1.13.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-09-29 00:00:00.000000000 Z
11
+ date: 2018-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit