Skip to content

Commit 495f094

Browse files
authored
tweak summary output (#43)
Signed-off-by: Brian DeHamer <bdehamer@github.com>
1 parent f7a204b commit 495f094

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

dist/index.js

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { predicateFromInputs } from './predicate'
1010
import { subjectFromInputs } from './subject'
1111

1212
type SigstoreInstance = 'public-good' | 'github'
13+
type AttestedSubject = { subject: Subject; attestationID: string }
1314

1415
const COLOR_CYAN = '\x1B[36m'
1516
const COLOR_DEFAULT = '\x1B[39m'
@@ -30,6 +31,7 @@ export async function run(): Promise<void> {
3031
: 'github'
3132

3233
try {
34+
const atts: AttestedSubject[] = []
3335
if (!process.env.ACTIONS_ID_TOKEN_REQUEST_URL) {
3436
throw new Error(
3537
'missing "id-token" permission. Please add "permissions: id-token: write" to your workflow.'
@@ -52,15 +54,23 @@ export async function run(): Promise<void> {
5254
})
5355

5456
if (att.attestationID) {
57+
atts.push({ subject, attestationID: att.attestationID })
58+
}
59+
}
60+
61+
if (atts.length > 0) {
62+
core.summary.addHeading(
63+
/* istanbul ignore next */
64+
atts.length > 1 ? 'Attestations Created' : 'Attestation Created',
65+
3
66+
)
67+
68+
for (const { subject, attestationID } of atts) {
5569
core.summary.addLink(
5670
`${subject.name}@${subjectDigest(subject)}`,
57-
attestationURL(att.attestationID)
71+
attestationURL(attestationID)
5872
)
5973
}
60-
}
61-
62-
if (!core.summary.isEmptyBuffer()) {
63-
core.summary.addHeading('Attestation(s) Created', 3)
6474
core.summary.write()
6575
}
6676

0 commit comments

Comments
 (0)