@@ -112,6 +112,7 @@ test('it sets the updated dependency as an output for subsequent actions when gi
112112 newVersion : '4.2.2' ,
113113 compatScore : 0 ,
114114 maintainerChanges : false ,
115+ dependencyGroup : '' ,
115116 alertState : '' ,
116117 ghsaId : '' ,
117118 cvss : 0
@@ -129,6 +130,7 @@ test('it sets the updated dependency as an output for subsequent actions when gi
129130 expect ( core . setOutput ) . toBeCalledWith ( 'new-version' , '4.2.2' )
130131 expect ( core . setOutput ) . toBeCalledWith ( 'compatibility-score' , 0 )
131132 expect ( core . setOutput ) . toBeCalledWith ( 'maintainer-changes' , false )
133+ expect ( core . setOutput ) . toBeCalledWith ( 'dependency-group' , '' )
132134 expect ( core . setOutput ) . toBeCalledWith ( 'alert-state' , '' )
133135 expect ( core . setOutput ) . toBeCalledWith ( 'ghsa-id' , '' )
134136 expect ( core . setOutput ) . toBeCalledWith ( 'cvss' , 0 )
@@ -179,6 +181,7 @@ test('it sets the updated dependency as an output for subsequent actions when th
179181 directory : '/' ,
180182 packageEcosystem : 'nuget' ,
181183 maintainerChanges : false ,
184+ dependencyGroup : '' ,
182185 targetBranch : 'main' ,
183186 prevVersion : 'v4.0.1' ,
184187 newVersion : 'v4.2.2' ,
@@ -200,11 +203,118 @@ test('it sets the updated dependency as an output for subsequent actions when th
200203 expect ( core . setOutput ) . toBeCalledWith ( 'new-version' , 'v4.2.2' )
201204 expect ( core . setOutput ) . toBeCalledWith ( 'compatibility-score' , 0 )
202205 expect ( core . setOutput ) . toBeCalledWith ( 'maintainer-changes' , false )
206+ expect ( core . setOutput ) . toBeCalledWith ( 'dependency-group' , '' )
203207 expect ( core . setOutput ) . toBeCalledWith ( 'alert-state' , '' )
204208 expect ( core . setOutput ) . toBeCalledWith ( 'ghsa-id' , '' )
205209 expect ( core . setOutput ) . toBeCalledWith ( 'cvss' , 0 )
206210} )
207211
212+ test ( 'it supports returning information about grouped updates' , async ( ) => {
213+ const mockCommitMessage =
214+ 'Bumps the docker group with 3 updates: [github.com/docker/cli](https://github.com/docker/cli), [github.com/docker/docker](https://github.com/docker/docker) and [github.com/moby/moby](https://github.com/moby/moby).\n' +
215+ '\n' +
216+ 'Updates `github.com/docker/cli` from 24.0.1+incompatible to 24.0.2+incompatible\n' +
217+ '- [Commits](docker/[email protected] )\n' + 218+ '\n' +
219+ 'Updates `github.com/docker/docker` from 24.0.1+incompatible to 24.0.2+incompatible\n' +
220+ '- [Release notes](https://github.com/docker/docker/releases)\n' +
221+ '- [Commits](moby/[email protected] )\n' + 222+ '\n' +
223+ 'Updates `github.com/moby/moby` from 24.0.1+incompatible to 24.0.2+incompatible\n' +
224+ '- [Release notes](https://github.com/moby/moby/releases)\n' +
225+ '- [Commits](moby/[email protected] )\n' + 226+ '\n' +
227+ '---\n' +
228+ 'updated-dependencies:\n' +
229+ '- dependency-name: github.com/docker/cli\n' +
230+ ' dependency-type: direct:production\n' +
231+ ' update-type: version-update:semver-patch\n' +
232+ '- dependency-name: github.com/docker/docker\n' +
233+ ' dependency-type: direct:production\n' +
234+ ' update-type: version-update:semver-patch\n' +
235+ '- dependency-name: github.com/moby/moby\n' +
236+ ' dependency-type: direct:production\n' +
237+ ' update-type: version-update:semver-patch\n' +
238+ '...\n' +
239+ '\n' +
240+ 'Signed-off-by: dependabot[bot] <[email protected] >\n' 241+
242+ const mockAlert = { alertState : '' , ghsaId : '' , cvss : 0 }
243+
244+ jest . spyOn ( core , 'getInput' ) . mockReturnValue ( 'mock-token' )
245+ jest . spyOn ( util , 'getBranchNames' ) . mockReturnValue ( { headName : 'dependabot/docker/gh-base-image/docker-1234566789' , baseName : 'trunk' } )
246+ jest . spyOn ( dependabotCommits , 'getMessage' ) . mockImplementation ( jest . fn (
247+ ( ) => Promise . resolve ( mockCommitMessage )
248+ ) )
249+ jest . spyOn ( dependabotCommits , 'getAlert' ) . mockImplementation ( jest . fn (
250+ ( ) => Promise . resolve ( mockAlert )
251+ ) )
252+ jest . spyOn ( dependabotCommits , 'getCompatibility' ) . mockImplementation ( jest . fn (
253+ ( ) => Promise . resolve ( 34 )
254+ ) )
255+ jest . spyOn ( core , 'setOutput' ) . mockImplementation ( jest . fn ( ) )
256+
257+ await run ( )
258+
259+ expect ( core . startGroup ) . toHaveBeenCalledWith (
260+ expect . stringContaining ( 'Outputting metadata for 3 updated dependencies' )
261+ )
262+
263+ expect ( core . setOutput ) . toHaveBeenCalledWith (
264+ 'updated-dependencies-json' ,
265+ [
266+ {
267+ dependencyName : 'github.com/docker/cli' ,
268+ dependencyType : 'direct:production' ,
269+ updateType : 'version-update:semver-patch' ,
270+ directory : '/' ,
271+ packageEcosystem : 'docker' ,
272+ targetBranch : 'trunk' ,
273+ prevVersion : '24.0.1' ,
274+ newVersion : '24.0.2' ,
275+ compatScore : 34 ,
276+ maintainerChanges : false ,
277+ dependencyGroup : 'docker' ,
278+ alertState : '' ,
279+ ghsaId : '' ,
280+ cvss : 0
281+ } ,
282+ {
283+ dependencyName : 'github.com/docker/docker' ,
284+ dependencyType : 'direct:production' ,
285+ updateType : 'version-update:semver-patch' ,
286+ directory : '/' ,
287+ packageEcosystem : 'docker' ,
288+ targetBranch : 'trunk' ,
289+ prevVersion : '24.0.1' ,
290+ newVersion : '24.0.2' ,
291+ compatScore : 34 ,
292+ maintainerChanges : false ,
293+ dependencyGroup : 'docker' ,
294+ alertState : '' ,
295+ ghsaId : '' ,
296+ cvss : 0
297+ } ,
298+ {
299+ dependencyName : 'github.com/moby/moby' ,
300+ dependencyType : 'direct:production' ,
301+ updateType : 'version-update:semver-patch' ,
302+ directory : '/' ,
303+ packageEcosystem : 'docker' ,
304+ targetBranch : 'trunk' ,
305+ prevVersion : '24.0.1' ,
306+ newVersion : '24.0.2' ,
307+ compatScore : 34 ,
308+ maintainerChanges : false ,
309+ dependencyGroup : 'docker' ,
310+ alertState : '' ,
311+ ghsaId : '' ,
312+ cvss : 0
313+ }
314+ ]
315+ )
316+ } )
317+
208318test ( 'it sets the updated dependency as an output for subsequent actions when given a commit message for library' , async ( ) => {
209319 const mockCommitMessage =
210320 'Update rubocop requirement from ~> 1.30.1 to ~> 1.31.0\n' +
@@ -253,6 +363,7 @@ test('it sets the updated dependency as an output for subsequent actions when gi
253363 packageEcosystem : 'bundler' ,
254364 targetBranch : 'main' ,
255365 maintainerChanges : false ,
366+ dependencyGroup : '' ,
256367 prevVersion : '1.30.1' ,
257368 newVersion : '1.31.0' ,
258369 compatScore : 0 ,
@@ -273,6 +384,7 @@ test('it sets the updated dependency as an output for subsequent actions when gi
273384 expect ( core . setOutput ) . toBeCalledWith ( 'new-version' , '1.31.0' )
274385 expect ( core . setOutput ) . toBeCalledWith ( 'compatibility-score' , 0 )
275386 expect ( core . setOutput ) . toBeCalledWith ( 'maintainer-changes' , false )
387+ expect ( core . setOutput ) . toBeCalledWith ( 'dependency-group' , '' )
276388 expect ( core . setOutput ) . toBeCalledWith ( 'alert-state' , '' )
277389 expect ( core . setOutput ) . toBeCalledWith ( 'ghsa-id' , '' )
278390 expect ( core . setOutput ) . toBeCalledWith ( 'cvss' , 0 )
@@ -332,6 +444,7 @@ test('if there are multiple dependencies, it summarizes them', async () => {
332444 newVersion : '4.2.2' ,
333445 compatScore : 34 ,
334446 maintainerChanges : false ,
447+ dependencyGroup : '' ,
335448 alertState : '' ,
336449 ghsaId : '' ,
337450 cvss : 0
@@ -347,6 +460,7 @@ test('if there are multiple dependencies, it summarizes them', async () => {
347460 newVersion : '' ,
348461 compatScore : 34 ,
349462 maintainerChanges : false ,
463+ dependencyGroup : '' ,
350464 alertState : '' ,
351465 ghsaId : '' ,
352466 cvss : 0
@@ -364,6 +478,7 @@ test('if there are multiple dependencies, it summarizes them', async () => {
364478 expect ( core . setOutput ) . toBeCalledWith ( 'new-version' , '4.2.2' )
365479 expect ( core . setOutput ) . toBeCalledWith ( 'compatibility-score' , 34 )
366480 expect ( core . setOutput ) . toBeCalledWith ( 'maintainer-changes' , false )
481+ expect ( core . setOutput ) . toBeCalledWith ( 'dependency-group' , '' )
367482 expect ( core . setOutput ) . toBeCalledWith ( 'alert-state' , '' )
368483 expect ( core . setOutput ) . toBeCalledWith ( 'ghsa-id' , '' )
369484 expect ( core . setOutput ) . toBeCalledWith ( 'cvss' , 0 )
0 commit comments