dependabot-common 0.107.40 → 0.107.41
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_updater/github.rb +22 -5
- 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: 9c172692c0a26319c3b803130f9d1f0f3c170a3eaf4908e0f5c67008c368dbe5
|
4
|
+
data.tar.gz: b44a858707c64dbcc05a24058601577a89026afb1abca8b6326068b0f2f92567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc7dcaa20d247d1406d225767c7f9b7048f29068f0ead1b11de61aea24b299f5727323a8999b9790906265c721c27182872ff2c7de00b2eed9c9ef748c0c7ab4
|
7
|
+
data.tar.gz: c99335ea809f1bc4dabcf17a5ccba4cef41541880a6c81871a30cad7bc1fcae27cce30ad27aa442f48d3038fc8988fd7d100dcf2ad5e2072b5c226250325f461
|
@@ -25,7 +25,8 @@ module Dependabot
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def update
|
28
|
-
return unless
|
28
|
+
return unless pull_request_exists?
|
29
|
+
return unless branch_exists?(pull_request.head.ref)
|
29
30
|
|
30
31
|
commit = create_commit
|
31
32
|
branch = update_branch(commit)
|
@@ -45,10 +46,19 @@ module Dependabot
|
|
45
46
|
base: target_branch
|
46
47
|
)
|
47
48
|
rescue Octokit::UnprocessableEntity => e
|
49
|
+
handle_pr_update_error(e)
|
50
|
+
end
|
51
|
+
|
52
|
+
def handle_pr_update_error(error)
|
48
53
|
# Return quietly if the PR has been closed
|
49
|
-
return
|
54
|
+
return if error.message.match?(/closed pull request/i)
|
50
55
|
|
51
|
-
|
56
|
+
# Ignore cases where the target branch has been deleted
|
57
|
+
return if error.message.include?("field: base") &&
|
58
|
+
source.branch &&
|
59
|
+
!branch_exists?(source.branch)
|
60
|
+
|
61
|
+
raise error
|
52
62
|
end
|
53
63
|
|
54
64
|
def github_client_for_source
|
@@ -59,6 +69,13 @@ module Dependabot
|
|
59
69
|
)
|
60
70
|
end
|
61
71
|
|
72
|
+
def pull_request_exists?
|
73
|
+
pull_request
|
74
|
+
true
|
75
|
+
rescue Octokit::NotFound
|
76
|
+
false
|
77
|
+
end
|
78
|
+
|
62
79
|
def pull_request
|
63
80
|
@pull_request ||=
|
64
81
|
github_client_for_source.pull_request(
|
@@ -67,8 +84,8 @@ module Dependabot
|
|
67
84
|
)
|
68
85
|
end
|
69
86
|
|
70
|
-
def branch_exists?
|
71
|
-
github_client_for_source.branch(source.repo,
|
87
|
+
def branch_exists?(name)
|
88
|
+
github_client_for_source.branch(source.repo, name)
|
72
89
|
rescue Octokit::NotFound
|
73
90
|
false
|
74
91
|
end
|
data/lib/dependabot/version.rb
CHANGED