dependabot-github_actions 0.212.0 → 0.213.0

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: b99470ea707631aca82d807b49067151dfcae50d66c60edc46d745c9616a0d74
4
- data.tar.gz: 199d27e6b67a81fe6f6728ab6a88800851788388b419b0b2df1ca6568c38b71b
3
+ metadata.gz: e40718bacbd579d5f066f1951840b92e43e2a4f9d18d35870b02e6cf43352a3d
4
+ data.tar.gz: df27ec63cc58ce499478d5d89f35f57b5d171a4cbc3487025e560efe6c4c8219
5
5
  SHA512:
6
- metadata.gz: 3a39a5301c8164912dca155d1f76237ee7023c332dd39d1aee61f9d57bfb222e8b67f41604a25806f9aca6bd8862bcbeff21243e54a3afac416e9027afd42ae1
7
- data.tar.gz: 9ea44575276134e6b20f23ac77db0d91b6e2b7d5bba7f52006ed7715cd6864825e53933ae9559bfeb3d2e317c2e8b652d3709247ea203f14e635fc047fdb939f
6
+ metadata.gz: 855575e94d06e5749ee006e0a20180c8de9bbdb519b9adb894ac4cd943aaa2c852c1714a92a44ed4e6c7736c64cb9c74af5824825fdc2dd57e0977aee3dcfd6f
7
+ data.tar.gz: 8bca4abb38782199a213843eb76a8ffddb204db1d3e68ed1310a794d0893d1f8545e62cf64cfbea87fd62174ffa8af3d3661ff3c646f2540864a2cb49bfa396e
@@ -6,7 +6,7 @@ require "dependabot/file_fetchers/base"
6
6
  module Dependabot
7
7
  module GithubActions
8
8
  class FileFetcher < Dependabot::FileFetchers::Base
9
- FILENAME_PATTERN = /^(\.github|action.ya?ml)$/.freeze
9
+ FILENAME_PATTERN = /^(\.github|action.ya?ml)$/
10
10
 
11
11
  def self.required_files_in?(filenames)
12
12
  filenames.any? { |f| f.match?(FILENAME_PATTERN) }
@@ -21,7 +21,7 @@ module Dependabot
21
21
  (?<repo>[\w.-]+)
22
22
  (?<path>/[^\@]+)?
23
23
  @(?<ref>.+)
24
- }x.freeze
24
+ }x
25
25
 
26
26
  def parse
27
27
  dependency_set = DependencySet.new
@@ -65,17 +65,41 @@ module Dependabot
65
65
  gsub(/@.*+/, "@#{new_req.fetch(:source).fetch(:ref)}")
66
66
 
67
67
  # Replace the old declaration that's preceded by a non-word character
68
- # and followed by a whitespace character (comments) or EOL
68
+ # and followed by a whitespace character (comments) or EOL.
69
+ # If the declaration is followed by a comment that lists the version associated
70
+ # with the SHA source ref, then update the comment to the human-readable new version.
71
+ # However, if the comment includes additional text beyond the version, for safety
72
+ # we skip updating the comment in case it's a custom note, todo, warning etc of some kind.
73
+ # See the related unit tests for examples.
69
74
  updated_content =
70
75
  updated_content.
71
76
  gsub(
72
- /(?<=\W|"|')#{Regexp.escape(old_declaration)}(?=\s|"|'|$)/,
73
- new_declaration
74
- )
77
+ /(?<=\W|"|')#{Regexp.escape(old_declaration)}(?<comment>\s+#.*)?(?=\s|"|'|$)/
78
+ ) do |match|
79
+ comment = Regexp.last_match(:comment)
80
+ match.gsub!(old_declaration, new_declaration)
81
+ if comment && (updated_comment = updated_version_comment(comment, new_req))
82
+ match.gsub!(comment, updated_comment)
83
+ end
84
+ match
85
+ end
75
86
  end
76
87
 
77
88
  updated_content
78
89
  end
90
+
91
+ def updated_version_comment(comment, new_req)
92
+ raise "No comment!" unless comment
93
+
94
+ comment = comment.rstrip
95
+ return unless dependency.previous_version && dependency.version
96
+ return unless comment.end_with? dependency.previous_version
97
+
98
+ git_checker = Dependabot::GitCommitChecker.new(dependency: dependency, credentials: credentials)
99
+ return unless git_checker.ref_looks_like_commit_sha?(new_req.fetch(:source).fetch(:ref))
100
+
101
+ comment.gsub(dependency.previous_version, dependency.version)
102
+ end
79
103
  end
80
104
  end
81
105
  end
@@ -7,7 +7,7 @@ module Dependabot
7
7
  module GithubActions
8
8
  # Lifted from the bundler package manager
9
9
  class Requirement < Gem::Requirement
10
- # For consistency with other langauges, we define a requirements array.
10
+ # For consistency with other languages, we define a requirements array.
11
11
  # Ruby doesn't have an `OR` separator for requirements, so it always
12
12
  # contains a single element.
13
13
  def self.requirements_array(requirement_string)
@@ -98,25 +98,15 @@ module Dependabot
98
98
  latest_tags = git_commit_checker.local_tags_for_latest_version_commit_sha
99
99
 
100
100
  # Find the latest version with the same precision as the pinned version.
101
- # Falls back to a version with the closest precision if no exact match.
102
- current_dots = dependency.version.split(".").length
103
- latest_tags.max do |a, b|
104
- next a[:version] <=> b[:version] unless shortened_semver_version_eq?(a[:version], b[:version])
105
-
106
- a_dots = a[:version].to_s.split(".").length
107
- b_dots = b[:version].to_s.split(".").length
108
- a_diff = (a_dots - current_dots).abs
109
- b_diff = (b_dots - current_dots).abs
110
- next -(a_diff <=> b_diff) unless a_diff == b_diff
111
-
112
- # preference to a less specific version if we have a tie
113
- next 1 if a_dots < current_dots
114
-
115
- -1
116
- end
101
+ current_precision = precision(dependency.version)
102
+ latest_tags.select { |tag| precision(tag[:version].to_s) == current_precision }.max_by { |tag| tag[:version] }
117
103
  end
118
104
  end
119
105
 
106
+ def precision(version)
107
+ version.split(".").length
108
+ end
109
+
120
110
  def updated_source
121
111
  # TODO: Support Docker sources
122
112
  return dependency_source_details unless git_dependency?
@@ -193,13 +183,6 @@ module Dependabot
193
183
  other_split[0..base_split.length - 1] == base_split
194
184
  end
195
185
 
196
- def shortened_semver_version_eq?(base_version, other_version)
197
- base = base_version.to_s
198
- other = other_version.to_s
199
-
200
- shortened_semver_eq?(base, other) || shortened_semver_eq?(other, base)
201
- end
202
-
203
186
  def find_container_branch(sha)
204
187
  SharedHelpers.run_shell_command("git fetch #{current_commit}")
205
188
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-github_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.212.0
4
+ version: 0.213.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2022-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,42 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.212.0
19
+ version: 0.213.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.212.0
27
- - !ruby/object:Gem::Dependency
28
- name: debase
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 0.2.3
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 0.2.3
41
- - !ruby/object:Gem::Dependency
42
- name: debase-ruby_core_source
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 0.10.16
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 0.10.16
26
+ version: 0.213.0
55
27
  - !ruby/object:Gem::Dependency
56
28
  name: debug
57
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +58,14 @@ dependencies:
86
58
  requirements:
87
59
  - - "~>"
88
60
  - !ruby/object:Gem::Version
89
- version: 3.12.0
61
+ version: 3.13.0
90
62
  type: :development
91
63
  prerelease: false
92
64
  version_requirements: !ruby/object:Gem::Requirement
93
65
  requirements:
94
66
  - - "~>"
95
67
  - !ruby/object:Gem::Version
96
- version: 3.12.0
68
+ version: 3.13.0
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: rake
99
71
  requirement: !ruby/object:Gem::Requirement
@@ -142,42 +114,28 @@ dependencies:
142
114
  requirements:
143
115
  - - "~>"
144
116
  - !ruby/object:Gem::Version
145
- version: 1.36.0
117
+ version: 1.37.1
146
118
  type: :development
147
119
  prerelease: false
148
120
  version_requirements: !ruby/object:Gem::Requirement
149
121
  requirements:
150
122
  - - "~>"
151
123
  - !ruby/object:Gem::Version
152
- version: 1.36.0
124
+ version: 1.37.1
153
125
  - !ruby/object:Gem::Dependency
154
126
  name: rubocop-performance
155
127
  requirement: !ruby/object:Gem::Requirement
156
128
  requirements:
157
129
  - - "~>"
158
130
  - !ruby/object:Gem::Version
159
- version: 1.14.2
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: 1.14.2
167
- - !ruby/object:Gem::Dependency
168
- name: ruby-debug-ide
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: 0.7.3
131
+ version: 1.15.0
174
132
  type: :development
175
133
  prerelease: false
176
134
  version_requirements: !ruby/object:Gem::Requirement
177
135
  requirements:
178
136
  - - "~>"
179
137
  - !ruby/object:Gem::Version
180
- version: 0.7.3
138
+ version: 1.15.0
181
139
  - !ruby/object:Gem::Dependency
182
140
  name: simplecov
183
141
  requirement: !ruby/object:Gem::Requirement
@@ -275,14 +233,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
275
233
  requirements:
276
234
  - - ">="
277
235
  - !ruby/object:Gem::Version
278
- version: 2.7.0
236
+ version: 3.1.0
279
237
  required_rubygems_version: !ruby/object:Gem::Requirement
280
238
  requirements:
281
239
  - - ">="
282
240
  - !ruby/object:Gem::Version
283
- version: 2.7.0
241
+ version: 3.1.0
284
242
  requirements: []
285
- rubygems_version: 3.1.6
243
+ rubygems_version: 3.3.7
286
244
  signing_key:
287
245
  specification_version: 4
288
246
  summary: GitHub Actions support for dependabot-common