@@ -112,6 +112,7 @@ test('it sets the updated dependency as an output for subsequent actions when gi
112
112
newVersion : '4.2.2' ,
113
113
compatScore : 0 ,
114
114
maintainerChanges : false ,
115
+ dependencyGroup : '' ,
115
116
alertState : '' ,
116
117
ghsaId : '' ,
117
118
cvss : 0
@@ -129,6 +130,7 @@ test('it sets the updated dependency as an output for subsequent actions when gi
129
130
expect ( core . setOutput ) . toBeCalledWith ( 'new-version' , '4.2.2' )
130
131
expect ( core . setOutput ) . toBeCalledWith ( 'compatibility-score' , 0 )
131
132
expect ( core . setOutput ) . toBeCalledWith ( 'maintainer-changes' , false )
133
+ expect ( core . setOutput ) . toBeCalledWith ( 'dependency-group' , '' )
132
134
expect ( core . setOutput ) . toBeCalledWith ( 'alert-state' , '' )
133
135
expect ( core . setOutput ) . toBeCalledWith ( 'ghsa-id' , '' )
134
136
expect ( core . setOutput ) . toBeCalledWith ( 'cvss' , 0 )
@@ -179,6 +181,7 @@ test('it sets the updated dependency as an output for subsequent actions when th
179
181
directory : '/' ,
180
182
packageEcosystem : 'nuget' ,
181
183
maintainerChanges : false ,
184
+ dependencyGroup : '' ,
182
185
targetBranch : 'main' ,
183
186
prevVersion : 'v4.0.1' ,
184
187
newVersion : 'v4.2.2' ,
@@ -200,11 +203,118 @@ test('it sets the updated dependency as an output for subsequent actions when th
200
203
expect ( core . setOutput ) . toBeCalledWith ( 'new-version' , 'v4.2.2' )
201
204
expect ( core . setOutput ) . toBeCalledWith ( 'compatibility-score' , 0 )
202
205
expect ( core . setOutput ) . toBeCalledWith ( 'maintainer-changes' , false )
206
+ expect ( core . setOutput ) . toBeCalledWith ( 'dependency-group' , '' )
203
207
expect ( core . setOutput ) . toBeCalledWith ( 'alert-state' , '' )
204
208
expect ( core . setOutput ) . toBeCalledWith ( 'ghsa-id' , '' )
205
209
expect ( core . setOutput ) . toBeCalledWith ( 'cvss' , 0 )
206
210
} )
207
211
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
+
208
318
test ( 'it sets the updated dependency as an output for subsequent actions when given a commit message for library' , async ( ) => {
209
319
const mockCommitMessage =
210
320
'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
253
363
packageEcosystem : 'bundler' ,
254
364
targetBranch : 'main' ,
255
365
maintainerChanges : false ,
366
+ dependencyGroup : '' ,
256
367
prevVersion : '1.30.1' ,
257
368
newVersion : '1.31.0' ,
258
369
compatScore : 0 ,
@@ -273,6 +384,7 @@ test('it sets the updated dependency as an output for subsequent actions when gi
273
384
expect ( core . setOutput ) . toBeCalledWith ( 'new-version' , '1.31.0' )
274
385
expect ( core . setOutput ) . toBeCalledWith ( 'compatibility-score' , 0 )
275
386
expect ( core . setOutput ) . toBeCalledWith ( 'maintainer-changes' , false )
387
+ expect ( core . setOutput ) . toBeCalledWith ( 'dependency-group' , '' )
276
388
expect ( core . setOutput ) . toBeCalledWith ( 'alert-state' , '' )
277
389
expect ( core . setOutput ) . toBeCalledWith ( 'ghsa-id' , '' )
278
390
expect ( core . setOutput ) . toBeCalledWith ( 'cvss' , 0 )
@@ -332,6 +444,7 @@ test('if there are multiple dependencies, it summarizes them', async () => {
332
444
newVersion : '4.2.2' ,
333
445
compatScore : 34 ,
334
446
maintainerChanges : false ,
447
+ dependencyGroup : '' ,
335
448
alertState : '' ,
336
449
ghsaId : '' ,
337
450
cvss : 0
@@ -347,6 +460,7 @@ test('if there are multiple dependencies, it summarizes them', async () => {
347
460
newVersion : '' ,
348
461
compatScore : 34 ,
349
462
maintainerChanges : false ,
463
+ dependencyGroup : '' ,
350
464
alertState : '' ,
351
465
ghsaId : '' ,
352
466
cvss : 0
@@ -364,6 +478,7 @@ test('if there are multiple dependencies, it summarizes them', async () => {
364
478
expect ( core . setOutput ) . toBeCalledWith ( 'new-version' , '4.2.2' )
365
479
expect ( core . setOutput ) . toBeCalledWith ( 'compatibility-score' , 34 )
366
480
expect ( core . setOutput ) . toBeCalledWith ( 'maintainer-changes' , false )
481
+ expect ( core . setOutput ) . toBeCalledWith ( 'dependency-group' , '' )
367
482
expect ( core . setOutput ) . toBeCalledWith ( 'alert-state' , '' )
368
483
expect ( core . setOutput ) . toBeCalledWith ( 'ghsa-id' , '' )
369
484
expect ( core . setOutput ) . toBeCalledWith ( 'cvss' , 0 )
0 commit comments