diff --git a/package.json b/package.json index a6d8c0e5..ce9f74bf 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@actions/http-client": "^2.2.3", "@actions/io": "^1.1.3", "@actions/tool-cache": "^2.0.2", + "@azure/core-http": "^3.0.0", "@azure/storage-blob": "^12.15.0", "@octokit/core": "^5.1.0", "@octokit/plugin-rest-endpoint-methods": "^10.4.0", diff --git a/src/github.ts b/src/github.ts index da2298d0..66a5bcb5 100644 --- a/src/github.ts +++ b/src/github.ts @@ -31,7 +31,7 @@ import {SummaryTableCell} from '@actions/core/lib/summary'; import * as github from '@actions/github'; import {GitHub as Octokit} from '@actions/github/lib/utils'; import {Context} from '@actions/github/lib/context'; -import {TransferProgressEvent} from '@azure/core-http'; +import {type TransferProgressEvent} from '@azure/core-http'; import {BlobClient, BlobHTTPHeaders} from '@azure/storage-blob'; import {jwtDecode, JwtPayload} from 'jwt-decode'; @@ -347,4 +347,32 @@ export class GitHub { core.info(`Writing summary`); await sum.addSeparator().write(); } + + public static async writeCloudSummary(refs: Array<{platform: string; refId: string}>) { + if (refs.length > 0) { + const sum = core.summary.addHeading('Docker Build Cloud summary', 2); + sum.addRaw('
Your builds were executed using Docker Build Cloud. You can view detailed build information, logs, and results for each build below:
'); + + // Build the table rows + const tableRows = [ + [ + {header: true, data: 'Platform'}, + {header: true, data: 'Build ID'}, + {header: true, data: 'Link'} + ] + ]; + for (const {platform, refId} of refs) { + const buildUrl = `https://app.docker.com/build/accounts/docker/builds/${platform}/${refId}`; + tableRows.push([ + {header: false, data: platform}, + {header: false, data: refId}, + {header: false, data: `${buildUrl}`} + ]); + core.info(`View build details: ${buildUrl}`); + } + sum.addTable(tableRows); + sum.addRaw('').addRaw('For more information about Docker Build Cloud, see ').addLink('the documentation', 'https://docs.docker.com/build/cloud/').addRaw('.').addRaw('
'); + await sum.addSeparator().write(); + } + } } diff --git a/yarn.lock b/yarn.lock index 0d8a0404..243309a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1114,6 +1114,7 @@ __metadata: "@actions/http-client": ^2.2.3 "@actions/io": ^1.1.3 "@actions/tool-cache": ^2.0.2 + "@azure/core-http": ^3.0.0 "@azure/storage-blob": ^12.15.0 "@octokit/core": ^5.1.0 "@octokit/plugin-rest-endpoint-methods": ^10.4.0