Skip to content

Commit 8c0b64d

Browse files
committed
github: fix summary handling for dbc
Signed-off-by: CrazyMax <[email protected]>
1 parent 34ddc49 commit 8c0b64d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/github.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,15 @@ export class GitHub {
233233
return `<a href="${url}">${text}</a>` + (addEOL ? os.EOL : '');
234234
};
235235

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];
236+
const refsSize = opts.exportRes.refs.length;
237+
const firstRef = refsSize > 0 ? opts.exportRes.refs?.[0] : undefined;
238+
const firstSummary = firstRef ? opts.exportRes.summaries?.[firstRef] : undefined;
239+
const dbcAccount = opts.driver === 'cloud' && opts.endpoint ? opts.endpoint?.replace(/^cloud:\/\//, '').split('/')[0] : undefined;
240240

241241
const sum = core.summary.addHeading('Docker Build summary', 2);
242242

243-
if (dbcAccount && singleRef && singleSummary) {
244-
const buildURL = GitHub.formatDBCBuildURL(dbcAccount, singleRef, singleSummary.defaultPlatform);
243+
if (dbcAccount && refsSize === 1 && firstRef && firstSummary) {
244+
const buildURL = GitHub.formatDBCBuildURL(dbcAccount, firstRef, firstSummary.defaultPlatform);
245245
// prettier-ignore
246246
sum.addRaw(`<p>`)
247247
.addRaw(`For a detailed look at the build, you can check the results at:`)

0 commit comments

Comments
 (0)