GeezerVison is showing github.com — Merge pull request #707 from crazy-max/fix-dbc-summary · docker/actions-toolkit@88d39b6
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/github.ts +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -233,15 +233,15 @@ export class GitHub { |
233 | 233 | return `<a href="${url}">${text}</a>` + (addEOL ? os.EOL : ''); |
234 | 234 | }; |
235 | 235 |
|
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; |
240 | 240 |
|
241 | 241 | const sum = core.summary.addHeading('Docker Build summary', 2); |
242 | 242 |
|
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); |
245 | 245 | // prettier-ignore |
246 | 246 | sum.addRaw(`<p>`) |
247 | 247 | .addRaw(`For a detailed look at the build, you can check the results at:`) |
|