circleci-bundle-update-pr 1.14.3 → 1.14.4

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: 8bdafb1b444baf9846b2158bfa36e3219c9862e6071630d05e05437aa496a5d5
4
- data.tar.gz: c0b3e21251127726e560cada9a584965cedacdc9136b91936da08f9ba7470795
3
+ metadata.gz: f0132033cd212b7a4de6428ae448cf78fc452f8766141e54eaeff0e85f583a32
4
+ data.tar.gz: 6265c70896a7a0e9e4aa474d0447a7b574ac6c9bcf901e055e843aa0fb2f0ad5
5
5
  SHA512:
6
- metadata.gz: e745407da1928387d9848a5031f883e2bfa5fd4b442903a48756f6b4876eabd87b05a72f2239450e4e8669c1d4842c68728c82cebd48f3b27cfca3e24fcdccfb
7
- data.tar.gz: 6944b8f80c97b25c2d15007a91ddf94175e9105c3c3ff91b496344e5277c76c4e3514291e468525a806161f4b79d2260a319b8c85d2ae4106dd59e1f2c0a0188
6
+ metadata.gz: 4c4825bd2e230a48f8ae2b67a7210bd430a6294188df0bdbd5506aa47fdbd7b1060a6c009cb96d57e72c3d655169806ed7cdfa3b985fb14f08067beb831fd214
7
+ data.tar.gz: bb016368f762b942f75cb7080052683ec83e097e40e95914e3153af2d49261b5ddc9b8e3fef74ccc749ccf15de0d93fcfcbe8b7e91e77a02c1730c1c080e1f95
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- circleci-bundle-update-pr (1.14.3)
4
+ circleci-bundle-update-pr (1.14.4)
5
5
  compare_linker (>= 1.4.0)
6
6
  octokit
7
7
 
@@ -18,7 +18,7 @@ GEM
18
18
  multipart-post (>= 1.2, < 3)
19
19
  httpclient (2.8.3)
20
20
  multipart-post (2.0.0)
21
- octokit (4.13.0)
21
+ octokit (4.14.0)
22
22
  sawyer (~> 0.8.0, >= 0.5.3)
23
23
  public_suffix (3.0.3)
24
24
  rake (12.3.2)
@@ -16,7 +16,12 @@ module Circleci
16
16
  return
17
17
  end
18
18
 
19
- unless need_to_commit?(git_branches)
19
+ unless target_branch?(running_branch: ENV['CIRCLE_BRANCH'], target_branches: git_branches)
20
+ puts "Skip because CIRCLE_BRANCH[#{ENV['CIRCLE_BRANCH']}] is not included in target branches[#{git_branches.join(',')}]."
21
+ return
22
+ end
23
+
24
+ unless need_to_commit?
20
25
  puts 'No changes due to bundle update'
21
26
  return
22
27
  end
@@ -68,12 +73,20 @@ module Circleci
68
73
  end
69
74
  private_class_method :exists_bundle_update_pr?
70
75
 
76
+ # Is running branch included in target_branches?
77
+ #
78
+ # @param running_branch [String]
79
+ # @param target_branches [Array<String>]
80
+ # @return [Boolean]
81
+ def self.target_branch?(running_branch:, target_branches:)
82
+ target_branches.include?(running_branch)
83
+ end
84
+ private_class_method :target_branch?
85
+
71
86
  # Does it need to commit due to bundle update?
72
87
  #
73
- # @param git_branches [Array<String>]
74
88
  # @return [Boolean]
75
- def self.need_to_commit?(git_branches)
76
- return false unless git_branches.include?(ENV['CIRCLE_BRANCH'])
89
+ def self.need_to_commit?
77
90
  unless system("bundle update && bundle update --ruby")
78
91
  raise "Unable to execute `bundle update && bundle update --ruby`"
79
92
  end
@@ -2,7 +2,7 @@ module Circleci
2
2
  module Bundle
3
3
  module Update
4
4
  module Pr
5
- VERSION = '1.14.3'
5
+ VERSION = '1.14.4'
6
6
  end
7
7
  end
8
8
  end
@@ -18,4 +18,29 @@ describe Circleci::Bundle::Update::Pr do
18
18
  it { is_expected.to eq 'github.com' }
19
19
  end
20
20
  end
21
+
22
+ describe ".target_branch?" do
23
+ subject do
24
+ Circleci::Bundle::Update::Pr.send(
25
+ :target_branch?,
26
+ running_branch: running_branch,
27
+ target_branches: ["target"],
28
+ )
29
+ end
30
+
31
+ context "running_target is included in target branches" do
32
+ let(:running_branch) { 'target' }
33
+ it { is_expected.to be_truthy }
34
+ end
35
+
36
+ context "ENV['CIRCLE_BRANCH'] is not included in target branches" do
37
+ let(:running_branch) { 'not_included' }
38
+ it { is_expected.to be_falsy }
39
+ end
40
+
41
+ context "ENV['CIRCLE_BRANCH'] is nil" do
42
+ let(:running_branch) { nil }
43
+ it { is_expected.to be_falsy }
44
+ end
45
+ end
21
46
  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.14.3
4
+ version: 1.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Masuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2019-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit