dependabot-common 0.166.1 → 0.169.1

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: 61f19fa2ef3292f2a0cf46f25675deee06beacb629351e06dfe3178d2187c51e
4
- data.tar.gz: ec099d3cf6b2839d0095cb13937366d1276488d96d73fdab0e461d52fa74e441
3
+ metadata.gz: dc46ffcae76793952cdf3cef0b40dfbfe7f56653b2e4751e6de45f63f6afd520
4
+ data.tar.gz: 6ef43fc6f4d044bfcb9d1ecea3f86d4d1f2814ecea267008b2c147952d6f0249
5
5
  SHA512:
6
- metadata.gz: c7e0cc953074f0428ca59ec66ba1b34eb2b7f82cd5b009d3865730e8d422bc57673d6d353c23cf69f5323080b855368c1c01db9459cd214fca11e462a173495e
7
- data.tar.gz: 37a8babd52a43df9bcc2d9c65371677f42c81ae57b8e17f17253084687a157721e97ad6279fbe4b379baf56975bcd9c3b75cbca06bc06a46ffd844480ae1bdd5
6
+ metadata.gz: f61399fd1dbc9703daffddddf2fe37a6d964347414f173ff277886335a4854fad4d33f142014893b934ea6f0272279d51768317ea6d3b34761aac4ec28ce24e1
7
+ data.tar.gz: 5b00638a76355f30b79c8e477c614b4d4cdffd388c48848b177d7547fadeafcea56ae71a00b2e34c23f45ef43821338d571b3d51d9fa9b8f2ce4ecbd16e8c6b1
@@ -18,6 +18,8 @@ module Dependabot
18
18
 
19
19
  class Forbidden < StandardError; end
20
20
 
21
+ class TagsCreationForbidden < StandardError; end
22
+
21
23
  RETRYABLE_ERRORS = [InternalServerError, BadGateway, ServiceNotAvailable].freeze
22
24
 
23
25
  MAX_PR_DESCRIPTION_LENGTH = 3999
@@ -264,7 +266,12 @@ module Dependabot
264
266
  end
265
267
 
266
268
  raise Unauthorized if response.status == 401
267
- raise Forbidden if response.status == 403
269
+
270
+ if response.status == 403
271
+ raise TagsCreationForbidden if tags_creation_forbidden?(response)
272
+
273
+ raise Forbidden
274
+ end
268
275
  raise NotFound if response.status == 404
269
276
 
270
277
  response
@@ -310,6 +317,13 @@ module Dependabot
310
317
  pr_description.force_encoding(Encoding::UTF_8)
311
318
  end
312
319
 
320
+ def tags_creation_forbidden?(response)
321
+ return if response.body.empty?
322
+
323
+ message = JSON.parse(response.body).fetch("message", nil)
324
+ message&.include?("TF401289")
325
+ end
326
+
313
327
  attr_reader :auth_header
314
328
  attr_reader :credentials
315
329
  attr_reader :source
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "excon"
4
- require "pandoc-ruby"
5
4
 
6
5
  require "dependabot/clients/github_with_retries"
7
6
  require "dependabot/clients/gitlab_with_retries"
@@ -37,31 +36,10 @@ module Dependabot
37
36
  def changelog_text
38
37
  return unless full_changelog_text
39
38
 
40
- pruned_text = ChangelogPruner.new(
39
+ ChangelogPruner.new(
41
40
  dependency: dependency,
42
41
  changelog_text: full_changelog_text
43
42
  ).pruned_text
44
-
45
- return pruned_text unless changelog.name.end_with?(".rst")
46
-
47
- begin
48
- PandocRuby.convert(
49
- pruned_text,
50
- from: :rst,
51
- to: :markdown,
52
- wrap: :none,
53
- timeout: 10
54
- )
55
- rescue Errno::ENOENT => e
56
- raise unless e.message == "No such file or directory - pandoc"
57
-
58
- # If pandoc isn't installed just return the rst
59
- pruned_text
60
- rescue RuntimeError => e
61
- raise unless e.message.include?("Pandoc timed out")
62
-
63
- pruned_text
64
- end
65
43
  end
66
44
 
67
45
  def upgrade_guide_url
@@ -142,6 +142,20 @@ module Dependabot
142
142
  end
143
143
 
144
144
  def message_trailers
145
+ return unless signoff_trailers || custom_trailers
146
+
147
+ [signoff_trailers, custom_trailers].compact.join("\n")
148
+ end
149
+
150
+ def custom_trailers
151
+ trailers = commit_message_options[:trailers]
152
+ return if trailers.nil?
153
+ raise("Commit trailers must be a Hash object") unless trailers.is_a?(Hash)
154
+
155
+ trailers.compact.map { |k, v| "#{k}: #{v}" }.join("\n")
156
+ end
157
+
158
+ def signoff_trailers
145
159
  return unless on_behalf_of_message || signoff_message
146
160
 
147
161
  [on_behalf_of_message, signoff_message].compact.join("\n")
@@ -23,7 +23,7 @@ module Dependabot
23
23
  #
24
24
  # If you wish to disable this behaviour when using Dependabot Core directly,
25
25
  # pass a nil value when initialising this class.
26
- DEFAULT_GITHUB_REDIRECTION_SERVICE = "github-redirect.dependabot.com"
26
+ DEFAULT_GITHUB_REDIRECTION_SERVICE = "redirect.github.com"
27
27
 
28
28
  class RepoNotFound < StandardError; end
29
29
 
@@ -280,10 +280,10 @@ module Dependabot
280
280
  FileUtils.mv(backup_path, GIT_CONFIG_GLOBAL_PATH)
281
281
  end
282
282
 
283
- def self.run_shell_command(command, allow_unsafe_shell_command: false)
283
+ def self.run_shell_command(command, allow_unsafe_shell_command: false, env: {})
284
284
  start = Time.now
285
285
  cmd = allow_unsafe_shell_command ? command : escape_command(command)
286
- stdout, process = Open3.capture2e(cmd)
286
+ stdout, process = Open3.capture2e(env || {}, cmd)
287
287
  time_taken = Time.now - start
288
288
 
289
289
  # Raise an error with the output from the shell session if the
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.166.1"
4
+ VERSION = "0.169.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.166.1
4
+ version: 0.169.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-14 00:00:00.000000000 Z
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -182,20 +182,6 @@ dependencies:
182
182
  - - "~>"
183
183
  - !ruby/object:Gem::Version
184
184
  version: '4.6'
185
- - !ruby/object:Gem::Dependency
186
- name: pandoc-ruby
187
- requirement: !ruby/object:Gem::Requirement
188
- requirements:
189
- - - "~>"
190
- - !ruby/object:Gem::Version
191
- version: '2.0'
192
- type: :runtime
193
- prerelease: false
194
- version_requirements: !ruby/object:Gem::Requirement
195
- requirements:
196
- - - "~>"
197
- - !ruby/object:Gem::Version
198
- version: '2.0'
199
185
  - !ruby/object:Gem::Dependency
200
186
  name: parser
201
187
  requirement: !ruby/object:Gem::Requirement