@@ -234,9 +234,23 @@ export class GitHub {
234
234
} ;
235
235
236
236
const refsSize = Object . keys ( opts . exportRes . refs ) . length ;
237
+ const singleRef = refsSize === 1 ? Object . keys ( opts . exportRes . refs ) [ 0 ] : undefined ;
238
+ const singleSummary = singleRef && opts . exportRes . summaries ?. [ singleRef ] ;
239
+ const dbcAccount = opts . driver === 'cloud' && opts . endpoint ?. split ( '/' ) [ 0 ] ;
237
240
238
241
const sum = core . summary . addHeading ( 'Docker Build summary' , 2 ) ;
239
242
243
+ if ( dbcAccount && singleRef && singleSummary ) {
244
+ const buildURL = GitHub . formatDBCBuildURL ( dbcAccount , singleRef , singleSummary . defaultPlatform ) ;
245
+ // prettier-ignore
246
+ sum . addRaw ( `<p>` )
247
+ . addRaw ( `For a detailed look at the build, you can check the results at:` )
248
+ . addRaw ( '</p>' )
249
+ . addRaw ( `<p>` )
250
+ . addRaw ( `:whale: ${ addLink ( `<strong>${ buildURL } </strong>` , buildURL ) } ` )
251
+ . addRaw ( `</p>` ) ;
252
+ }
253
+
240
254
if ( opts . uploadRes ) {
241
255
// we just need the last two parts of the URL as they are always relative
242
256
// to the workflow run URL otherwise URL could be broken if GitHub
@@ -246,17 +260,29 @@ export class GitHub {
246
260
// https://github.com/docker/actions-toolkit/issues/367
247
261
const artifactRelativeURL = `./${ GitHub . runId } /${ opts . uploadRes . url . split ( '/' ) . slice ( - 2 ) . join ( '/' ) } ` ;
248
262
263
+ if ( dbcAccount && refsSize === 1 ) {
264
+ // prettier-ignore
265
+ sum . addRaw ( `<p>` )
266
+ . addRaw ( `You can also download the following build record archive and import it into Docker Desktop's Builds view. ` )
267
+ . addBreak ( )
268
+ . addRaw ( `Build records include details such as timing, dependencies, results, logs, traces, and other information about a build. ` )
269
+ . addRaw ( addLink ( 'Learn more' , 'https://www.docker.com/blog/new-beta-feature-deep-dive-into-github-actions-docker-builds-with-docker-desktop/?utm_source=github&utm_medium=actions' ) )
270
+ . addRaw ( '</p>' )
271
+ } else {
272
+ // prettier-ignore
273
+ sum . addRaw ( `<p>` )
274
+ . addRaw ( `For a detailed look at the build, download the following build record archive and import it into Docker Desktop's Builds view. ` )
275
+ . addBreak ( )
276
+ . addRaw ( `Build records include details such as timing, dependencies, results, logs, traces, and other information about a build. ` )
277
+ . addRaw ( addLink ( 'Learn more' , 'https://www.docker.com/blog/new-beta-feature-deep-dive-into-github-actions-docker-builds-with-docker-desktop/?utm_source=github&utm_medium=actions' ) )
278
+ . addRaw ( '</p>' )
279
+ }
280
+
249
281
// prettier-ignore
250
282
sum . addRaw ( `<p>` )
251
- . addRaw ( `For a detailed look at the build, download the following build record archive and import it into Docker Desktop's Builds view. ` )
252
- . addBreak ( )
253
- . addRaw ( `Build records include details such as timing, dependencies, results, logs, traces, and other information about a build. ` )
254
- . addRaw ( addLink ( 'Learn more' , 'https://www.docker.com/blog/new-beta-feature-deep-dive-into-github-actions-docker-builds-with-docker-desktop/?utm_source=github&utm_medium=actions' ) )
255
- . addRaw ( '</p>' )
256
- . addRaw ( `<p>` )
257
283
. addRaw ( `:arrow_down: ${ addLink ( `<strong>${ Util . stringToUnicodeEntities ( opts . uploadRes . filename ) } </strong>` , artifactRelativeURL ) } (${ Util . formatFileSize ( opts . uploadRes . size ) } - includes <strong>${ refsSize } build record${ refsSize > 1 ? 's' : '' } </strong>)` )
258
284
. addRaw ( `</p>` ) ;
259
- } else {
285
+ } else if ( opts . exportRes . summaries ) {
260
286
// prettier-ignore
261
287
sum . addRaw ( `<p>` )
262
288
. addRaw ( `The following table provides a brief summary of your build.` )
@@ -273,12 +299,14 @@ export class GitHub {
273
299
// Preview
274
300
sum . addRaw ( '<p>' ) ;
275
301
const summaryTableData : Array < Array < SummaryTableCell > > = [
302
+ // prettier-ignore
276
303
[
277
304
{ header : true , data : 'ID' } ,
278
305
{ header : true , data : 'Name' } ,
279
306
{ header : true , data : 'Status' } ,
280
307
{ header : true , data : 'Cached' } ,
281
- { header : true , data : 'Duration' }
308
+ { header : true , data : 'Duration' } ,
309
+ ...( dbcAccount && refsSize > 1 ? [ { header : true , data : 'Build result URL' } ] : [ ] )
282
310
]
283
311
] ;
284
312
let buildError : string | undefined ;
@@ -287,12 +315,13 @@ export class GitHub {
287
315
const summary = opts . exportRes . summaries [ ref ] ;
288
316
// prettier-ignore
289
317
summaryTableData . push ( [
290
- { data : `<code>${ ref . substring ( 0 , 6 ) . toUpperCase ( ) } </code>` } ,
291
- { data : `<strong>${ Util . stringToUnicodeEntities ( summary . name ) } </strong>` } ,
292
- { data : `${ summary . status === 'completed' ? ':white_check_mark:' : summary . status === 'canceled' ? ':no_entry_sign:' : ':x:' } ${ summary . status } ` } ,
293
- { data : `${ summary . numCachedSteps > 0 ? Math . round ( ( summary . numCachedSteps / summary . numTotalSteps ) * 100 ) : 0 } %` } ,
294
- { data : summary . duration }
295
- ] ) ;
318
+ { data : `<code>${ ref . substring ( 0 , 6 ) . toUpperCase ( ) } </code>` } ,
319
+ { data : `<strong>${ Util . stringToUnicodeEntities ( summary . name ) } </strong>` } ,
320
+ { data : `${ summary . status === 'completed' ? ':white_check_mark:' : summary . status === 'canceled' ? ':no_entry_sign:' : ':x:' } ${ summary . status } ` } ,
321
+ { data : `${ summary . numCachedSteps > 0 ? Math . round ( ( summary . numCachedSteps / summary . numTotalSteps ) * 100 ) : 0 } %` } ,
322
+ { data : summary . duration } ,
323
+ ...( dbcAccount && refsSize > 1 ? [ { data : addLink ( ':whale: Open' , GitHub . formatDBCBuildURL ( dbcAccount , ref , summary . defaultPlatform ) ) } ] : [ ] )
324
+ ] ) ;
296
325
if ( summary . error ) {
297
326
buildError = summary . error ;
298
327
}
@@ -347,4 +376,8 @@ export class GitHub {
347
376
core . info ( `Writing summary` ) ;
348
377
await sum . addSeparator ( ) . write ( ) ;
349
378
}
379
+
380
+ private static formatDBCBuildURL ( account : string , ref : string , platform ?: string ) : string {
381
+ return `https://app.docker.com/build/accounts/${ account } /builds/${ ( platform ?? 'linux/amd64' ) . replace ( '/' , '-' ) } /${ ref } ` ;
382
+ }
350
383
}
0 commit comments