dependabot-common 0.117.9 → 0.117.10

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: 6f710414291a0cefb5182b4f60f8da211abcf76b2b42564cc22e03c497a2c9f6
4
- data.tar.gz: c7e6f540ecca5e370eec9a7c6632d7a1d3408bbf999a99e222da931160da6de2
3
+ metadata.gz: a2a9d6ee089d6bb1c3e08a6858d924b995e13bfa7238746ccd8c55d217517185
4
+ data.tar.gz: 67048f550cf7595808e21d0cdf4864bf662140706261b3843f19bc480028c5c6
5
5
  SHA512:
6
- metadata.gz: c9840fd6d06b5f0fe8812b18ab2d0a713dea432affb9de3868ad6629730a83cbecfc9ae1c760d6c812a71fca5216e59d9a2a414a40eecfd3997a9d1cbb74a49f
7
- data.tar.gz: d954e4e5ca6ba0463ec284afdc200b4e71e35df24801488965e814b68df4b106453e26434175ff0c573f0d7d15d49ea4157a2116688a6faae00f9fd1da71edde
6
+ metadata.gz: e3211d6c6f5da2b379377cf28552d5173ccda7285bad50e1a85c433a0202655cd414ca21d80b521f925092faa22d1eb64ddb9066d91384f8d19e5399b9c8fcc7
7
+ data.tar.gz: '087ea4164b328bb0ed195b8a4f44c0c92358b1e763d186f22008f704097a59d16403c8d304cd503c1697631f5c022c7b143d69d10f27ccd458f384050199907c'
@@ -6,6 +6,8 @@ module Dependabot
6
6
  class PullRequestCreator
7
7
  class Labeler
8
8
  DEPENDENCIES_LABEL_REGEX = %r{^[^/]*dependenc[^/]+$}i.freeze
9
+ DEFAULT_DEPENDENCIES_LABEL = "dependencies"
10
+ DEFAULT_SECURITY_LABEL = "security"
9
11
 
10
12
  @package_manager_labels = {}
11
13
 
@@ -170,12 +172,18 @@ module Dependabot
170
172
  if custom_labels then custom_labels & labels
171
173
  else
172
174
  [
173
- labels.find { |l| l.match?(DEPENDENCIES_LABEL_REGEX) },
175
+ default_dependencies_label,
174
176
  label_language? ? language_label : nil
175
177
  ].compact
176
178
  end
177
179
  end
178
180
 
181
+ # Find the exact match first and then fallback to *dependenc* label
182
+ def default_dependencies_label
183
+ labels.find { |l| l == DEFAULT_DEPENDENCIES_LABEL } ||
184
+ labels.find { |l| l.match?(DEPENDENCIES_LABEL_REGEX) }
185
+ end
186
+
179
187
  def dependencies_label_exists?
180
188
  labels.any? { |l| l.match?(DEPENDENCIES_LABEL_REGEX) }
181
189
  end
@@ -260,7 +268,12 @@ module Dependabot
260
268
  self.class.label_details_for_package_manager(package_manager).
261
269
  fetch(:name)
262
270
 
263
- @labels = [*@labels, "dependencies", "security", langauge_name].uniq
271
+ @labels = [
272
+ *@labels,
273
+ DEFAULT_DEPENDENCIES_LABEL,
274
+ DEFAULT_SECURITY_LABEL,
275
+ langauge_name
276
+ ].uniq
264
277
  end
265
278
 
266
279
  def create_dependencies_label
@@ -292,44 +305,44 @@ module Dependabot
292
305
 
293
306
  def create_github_dependencies_label
294
307
  github_client_for_source.add_label(
295
- source.repo, "dependencies", "0366d6",
308
+ source.repo, DEFAULT_DEPENDENCIES_LABEL, "0366d6",
296
309
  description: "Pull requests that update a dependency file",
297
310
  accept: "application/vnd.github.symmetra-preview+json"
298
311
  )
299
- @labels = [*@labels, "dependencies"].uniq
312
+ @labels = [*@labels, DEFAULT_DEPENDENCIES_LABEL].uniq
300
313
  rescue Octokit::UnprocessableEntity => e
301
314
  raise unless e.errors.first.fetch(:code) == "already_exists"
302
315
 
303
- @labels = [*@labels, "dependencies"].uniq
316
+ @labels = [*@labels, DEFAULT_DEPENDENCIES_LABEL].uniq
304
317
  end
305
318
 
306
319
  def create_gitlab_dependencies_label
307
320
  gitlab_client_for_source.create_label(
308
- source.repo, "dependencies", "#0366d6",
321
+ source.repo, DEFAULT_DEPENDENCIES_LABEL, "#0366d6",
309
322
  description: "Pull requests that update a dependency file"
310
323
  )
311
- @labels = [*@labels, "dependencies"].uniq
324
+ @labels = [*@labels, DEFAULT_DEPENDENCIES_LABEL].uniq
312
325
  end
313
326
 
314
327
  def create_github_security_label
315
328
  github_client_for_source.add_label(
316
- source.repo, "security", "ee0701",
329
+ source.repo, DEFAULT_SECURITY_LABEL, "ee0701",
317
330
  description: "Pull requests that address a security vulnerability",
318
331
  accept: "application/vnd.github.symmetra-preview+json"
319
332
  )
320
- @labels = [*@labels, "security"].uniq
333
+ @labels = [*@labels, DEFAULT_SECURITY_LABEL].uniq
321
334
  rescue Octokit::UnprocessableEntity => e
322
335
  raise unless e.errors.first.fetch(:code) == "already_exists"
323
336
 
324
- @labels = [*@labels, "security"].uniq
337
+ @labels = [*@labels, DEFAULT_SECURITY_LABEL].uniq
325
338
  end
326
339
 
327
340
  def create_gitlab_security_label
328
341
  gitlab_client_for_source.create_label(
329
- source.repo, "security", "#ee0701",
342
+ source.repo, DEFAULT_SECURITY_LABEL, "#ee0701",
330
343
  description: "Pull requests that address a security vulnerability"
331
344
  )
332
- @labels = [*@labels, "security"].uniq
345
+ @labels = [*@labels, DEFAULT_SECURITY_LABEL].uniq
333
346
  end
334
347
 
335
348
  def create_github_language_label
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.117.9"
4
+ VERSION = "0.117.10"
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.117.9
4
+ version: 0.117.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit