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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb5727f4b83578a8a0a1d6da3334103cdff42d6b694984e31496eafdd2c91455
4
- data.tar.gz: 2c42ce1e5135c4281a0d8aaced1b1643a186064aa06f16cc2a017f1cf5e3578c
3
+ metadata.gz: 9c172692c0a26319c3b803130f9d1f0f3c170a3eaf4908e0f5c67008c368dbe5
4
+ data.tar.gz: b44a858707c64dbcc05a24058601577a89026afb1abca8b6326068b0f2f92567
5
5
  SHA512:
6
- metadata.gz: 9f0dfa22f1f6297a19870322bdfb6fb1760e2ff439bb16b21ce3cd1fecb9dfd50fdb7f60306b9631dd278f631db9fa8685f8f46dbd7edf73eed83bc61547e794
7
- data.tar.gz: '0729eef60bdbd45737a77e2f79e743bf5857cc5db995cc16f3e1d3c9aa614d53f90851e6a53cfda2d35b5ba1866dac18cff7f7783541f116acfd0cb69ce3057d'
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 branch_exists?
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 nil if e.message.match?(/closed pull request/i)
54
+ return if error.message.match?(/closed pull request/i)
50
55
 
51
- raise
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, pull_request.head.ref)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.107.40"
4
+ VERSION = "0.107.41"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.107.40
4
+ version: 0.107.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot