dependabot-common 0.273.0 → 0.274.0

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: be0c28765d665424088cb737d933cf376c29d931e1d642f96562d362c406fcf0
4
- data.tar.gz: de8f912ee099ed27b8d14811f7fb67f9b83119dc7db2483645947b2cd12b380d
3
+ metadata.gz: b66339af7fa82be186be4ee8d99c24b172a12a4f2233da1bebe2817f154066bf
4
+ data.tar.gz: eeec78de4dda472c4a53845919ff52a047569cbc57591fd413be347ccce48d0c
5
5
  SHA512:
6
- metadata.gz: e45c119606e121da9f919de9e40ff1ae63e22ad0167308bcb1e74b626296607fa8d05634ccb7ac922943d547c0f99820fab5c89fe105580146b5dc2224fbd97a
7
- data.tar.gz: 2bc6a5d526316d9d81cbfb0e03d06699a28e03757ff36f07a46d870a1e55a89794ffd834f3c1c8e21c7ccf737ed325bc1af111a2e22234641c54e1bb9d8cd56b
6
+ metadata.gz: 785f6759f110b6fe1ddbe90140f11a5232765af5d89e61d375cb6c65bbfa5638d465da7881cea0c500a11a01ea91771466fab3e27a38023d88132455df3b85a7
7
+ data.tar.gz: 85c60d21f9a03997bf4b18dd8048c05934a6a01e755bce68e3adbea553662d62d16c24610103731c9d6e145030dcf67730f3961c9aefce9a893ae3da782c6d4b
@@ -18,6 +18,9 @@ module Dependabot
18
18
  sig { returns(T.nilable(String)) }
19
19
  attr_reader :target_branch
20
20
 
21
+ sig { returns(T::Array[String]) }
22
+ attr_reader :existing_branches
23
+
21
24
  sig { returns(String) }
22
25
  attr_reader :separator
23
26
 
@@ -32,20 +35,22 @@ module Dependabot
32
35
  dependencies: T::Array[Dependency],
33
36
  files: T::Array[DependencyFile],
34
37
  target_branch: T.nilable(String),
38
+ existing_branches: T::Array[String],
35
39
  separator: String,
36
40
  prefix: String,
37
41
  max_length: T.nilable(Integer)
38
42
  )
39
43
  .void
40
44
  end
41
- def initialize(dependencies:, files:, target_branch:, separator: "/",
42
- prefix: "dependabot", max_length: nil)
43
- @dependencies = dependencies
44
- @files = files
45
- @target_branch = target_branch
46
- @separator = separator
47
- @prefix = prefix
48
- @max_length = max_length
45
+ def initialize(dependencies:, files:, target_branch:, existing_branches: [],
46
+ separator: "/", prefix: "dependabot", max_length: nil)
47
+ @dependencies = dependencies
48
+ @files = files
49
+ @target_branch = target_branch
50
+ @existing_branches = existing_branches
51
+ @separator = separator
52
+ @prefix = prefix
53
+ @max_length = max_length
49
54
  end
50
55
 
51
56
  sig { overridable.returns(String) }
@@ -69,7 +74,25 @@ module Dependabot
69
74
  sanitized_name[[T.must(max_length) - sha.size, 0].max..] = sha
70
75
  end
71
76
 
72
- sanitized_name
77
+ if Dependabot::Experiments.enabled?(:dedup_branch_names)
78
+ dedup_existing_branches(sanitized_name)
79
+ else
80
+ sanitized_name
81
+ end
82
+ end
83
+
84
+ sig { params(ref: String).returns(String) }
85
+ def dedup_existing_branches(ref)
86
+ return ref unless existing_branches.include?(ref)
87
+
88
+ i = 1
89
+ new_ref = "#{ref}-#{i}"
90
+ while existing_branches.include?(new_ref)
91
+ i += 1
92
+ new_ref = "#{ref}-#{i}"
93
+ end
94
+
95
+ new_ref
73
96
  end
74
97
 
75
98
  sig { params(ref: String).returns(String) }
@@ -17,6 +17,7 @@ module Dependabot
17
17
  target_branch: T.nilable(String),
18
18
  dependency_group: Dependabot::DependencyGroup,
19
19
  includes_security_fixes: T::Boolean,
20
+ existing_branches: T::Array[String],
20
21
  separator: String,
21
22
  prefix: String,
22
23
  max_length: T.nilable(Integer)
@@ -24,11 +25,12 @@ module Dependabot
24
25
  .void
25
26
  end
26
27
  def initialize(dependencies:, files:, target_branch:, dependency_group:, includes_security_fixes:,
27
- separator: "/", prefix: "dependabot", max_length: nil)
28
+ existing_branches: [], separator: "/", prefix: "dependabot", max_length: nil)
28
29
  super(
29
30
  dependencies: dependencies,
30
31
  files: files,
31
32
  target_branch: target_branch,
33
+ existing_branches: existing_branches,
32
34
  separator: separator,
33
35
  prefix: prefix,
34
36
  max_length: max_length,
@@ -23,6 +23,9 @@ module Dependabot
23
23
  sig { returns(T.nilable(String)) }
24
24
  attr_reader :target_branch
25
25
 
26
+ sig { returns(T::Array[String]) }
27
+ attr_reader :existing_branches
28
+
26
29
  sig { returns(String) }
27
30
  attr_reader :separator
28
31
 
@@ -44,6 +47,7 @@ module Dependabot
44
47
  files: T::Array[Dependabot::DependencyFile],
45
48
  target_branch: T.nilable(String),
46
49
  dependency_group: T.nilable(Dependabot::DependencyGroup),
50
+ existing_branches: T::Array[String],
47
51
  separator: String,
48
52
  prefix: String,
49
53
  max_length: T.nilable(Integer),
@@ -51,12 +55,13 @@ module Dependabot
51
55
  )
52
56
  .void
53
57
  end
54
- def initialize(dependencies:, files:, target_branch:, dependency_group: nil,
58
+ def initialize(dependencies:, files:, target_branch:, dependency_group: nil, existing_branches: [],
55
59
  separator: "/", prefix: "dependabot", max_length: nil, includes_security_fixes: false)
56
60
  @dependencies = dependencies
57
61
  @files = files
58
62
  @target_branch = target_branch
59
63
  @dependency_group = dependency_group
64
+ @existing_branches = existing_branches
60
65
  @separator = separator
61
66
  @prefix = prefix
62
67
  @max_length = max_length
@@ -78,6 +83,7 @@ module Dependabot
78
83
  dependencies: dependencies,
79
84
  files: files,
80
85
  target_branch: target_branch,
86
+ existing_branches: existing_branches,
81
87
  separator: separator,
82
88
  prefix: prefix,
83
89
  max_length: max_length
@@ -89,6 +95,7 @@ module Dependabot
89
95
  target_branch: target_branch,
90
96
  dependency_group: T.must(dependency_group),
91
97
  includes_security_fixes: includes_security_fixes,
98
+ existing_branches: existing_branches,
92
99
  separator: separator,
93
100
  prefix: prefix,
94
101
  max_length: max_length
@@ -115,6 +115,9 @@ module Dependabot
115
115
  sig { returns(T.nilable(T.any(T::Array[String], Integer))) }
116
116
  attr_reader :milestone
117
117
 
118
+ sig { returns(T::Array[String]) }
119
+ attr_reader :existing_branches
120
+
118
121
  sig { returns(String) }
119
122
  attr_reader :branch_name_separator
120
123
 
@@ -159,6 +162,7 @@ module Dependabot
159
162
  reviewers: Reviewers,
160
163
  assignees: T.nilable(T.any(T::Array[String], T::Array[Integer])),
161
164
  milestone: T.nilable(T.any(T::Array[String], Integer)),
165
+ existing_branches: T::Array[String],
162
166
  branch_name_separator: String,
163
167
  branch_name_prefix: String,
164
168
  branch_name_max_length: T.nilable(Integer),
@@ -182,9 +186,9 @@ module Dependabot
182
186
  custom_labels: nil, author_details: nil, signature_key: nil,
183
187
  commit_message_options: {}, vulnerabilities_fixed: {},
184
188
  reviewers: nil, assignees: nil, milestone: nil,
185
- branch_name_separator: "/", branch_name_prefix: "dependabot",
186
- branch_name_max_length: nil, label_language: false,
187
- automerge_candidate: false,
189
+ existing_branches: [], branch_name_separator: "/",
190
+ branch_name_prefix: "dependabot", branch_name_max_length: nil,
191
+ label_language: false, automerge_candidate: false,
188
192
  github_redirection_service: DEFAULT_GITHUB_REDIRECTION_SERVICE,
189
193
  custom_headers: nil, require_up_to_date_base: false,
190
194
  provider_metadata: {}, message: nil, dependency_group: nil, pr_message_max_length: nil,
@@ -204,6 +208,7 @@ module Dependabot
204
208
  @assignees = assignees
205
209
  @milestone = milestone
206
210
  @vulnerabilities_fixed = vulnerabilities_fixed
211
+ @existing_branches = existing_branches
207
212
  @branch_name_separator = branch_name_separator
208
213
  @branch_name_prefix = branch_name_prefix
209
214
  @branch_name_max_length = branch_name_max_length
@@ -397,6 +402,7 @@ module Dependabot
397
402
  files: files,
398
403
  target_branch: source.branch,
399
404
  dependency_group: dependency_group,
405
+ existing_branches: existing_branches,
400
406
  separator: branch_name_separator,
401
407
  prefix: branch_name_prefix,
402
408
  max_length: branch_name_max_length,
data/lib/dependabot.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Dependabot
5
- VERSION = "0.273.0"
5
+ VERSION = "0.274.0"
6
6
  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.273.0
4
+ version: 0.274.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-29 00:00:00.000000000 Z
11
+ date: 2024-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit
@@ -600,7 +600,7 @@ licenses:
600
600
  - MIT
601
601
  metadata:
602
602
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
603
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.273.0
603
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.274.0
604
604
  post_install_message:
605
605
  rdoc_options: []
606
606
  require_paths: