dependabot-common 0.99.2 → 0.99.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/pull_request_creator/github.rb +18 -7
- data/lib/dependabot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4806c3daa2f6d726a4a4718411d198958e05a3df78aadcb989a10dcdbe4ccf05
|
4
|
+
data.tar.gz: 87a85c82d5830f41b3d4c7861f148db6190c4cb9606fb687a5048a4c88308c9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 286596b6d37125696ef60b9fc69c3c16b46a353b7b4dcb1d128a4ce4f1891fe360be6de53bc3a50179656615a35be2cd3f93b68fa1548f33f7a6062875f7ef91
|
7
|
+
data.tar.gz: 41a3b1c98c6591f17b88596d55072a6b376e3566c4095051b9d91e5b2a3b266cd632de2d54e36cf837c9d0668df84edaa6ed8aa047b8327e16e49e7af0e9a95f
|
@@ -35,7 +35,7 @@ module Dependabot
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def create
|
38
|
-
return if branch_exists? && pull_request_exists?
|
38
|
+
return if branch_exists?(branch_name) && pull_request_exists?
|
39
39
|
|
40
40
|
commit = create_commit
|
41
41
|
branch = create_or_update_branch(commit)
|
@@ -61,13 +61,13 @@ module Dependabot
|
|
61
61
|
)
|
62
62
|
end
|
63
63
|
|
64
|
-
def branch_exists?
|
64
|
+
def branch_exists?(name)
|
65
65
|
@branch_ref ||=
|
66
|
-
github_client_for_source.ref(source.repo, "heads/#{
|
66
|
+
github_client_for_source.ref(source.repo, "heads/#{name}")
|
67
67
|
if @branch_ref.is_a?(Array)
|
68
|
-
@branch_ref.any? { |r| r.ref == "refs/heads/#{
|
68
|
+
@branch_ref.any? { |r| r.ref == "refs/heads/#{name}" }
|
69
69
|
else
|
70
|
-
@branch_ref.ref == "refs/heads/#{
|
70
|
+
@branch_ref.ref == "refs/heads/#{name}"
|
71
71
|
end
|
72
72
|
rescue Octokit::NotFound
|
73
73
|
false
|
@@ -162,7 +162,11 @@ module Dependabot
|
|
162
162
|
end
|
163
163
|
|
164
164
|
def create_or_update_branch(commit)
|
165
|
-
branch_exists?
|
165
|
+
if branch_exists?(branch_name)
|
166
|
+
update_branch(commit)
|
167
|
+
else
|
168
|
+
create_branch(commit)
|
169
|
+
end
|
166
170
|
rescue Octokit::UnprocessableEntity
|
167
171
|
# A race condition may cause GitHub to fail here, in which case we retry
|
168
172
|
retry_count ||= 0
|
@@ -253,7 +257,14 @@ module Dependabot
|
|
253
257
|
)
|
254
258
|
rescue Octokit::UnprocessableEntity => error
|
255
259
|
# Ignore races that we lose
|
256
|
-
|
260
|
+
return if error.message.include?("pull request already exists")
|
261
|
+
|
262
|
+
# Ignore cases where the target branch has been deleted
|
263
|
+
return if error.message.include?("field: base") &&
|
264
|
+
source.branch &&
|
265
|
+
!branch_exists?(source.branch)
|
266
|
+
|
267
|
+
raise
|
257
268
|
end
|
258
269
|
|
259
270
|
def default_branch
|
data/lib/dependabot/version.rb
CHANGED