Skip to content

Commit

Permalink
tweak summary output (#43)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian DeHamer <[email protected]>
  • Loading branch information
bdehamer authored Apr 26, 2024
1 parent f7a204b commit 495f094
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
12 changes: 9 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { predicateFromInputs } from './predicate'
import { subjectFromInputs } from './subject'

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

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

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

if (att.attestationID) {
atts.push({ subject, attestationID: att.attestationID })
}
}

if (atts.length > 0) {
core.summary.addHeading(
/* istanbul ignore next */
atts.length > 1 ? 'Attestations Created' : 'Attestation Created',
3
)

for (const { subject, attestationID } of atts) {
core.summary.addLink(
`${subject.name}@${subjectDigest(subject)}`,
attestationURL(att.attestationID)
attestationURL(attestationID)
)
}
}

if (!core.summary.isEmptyBuffer()) {
core.summary.addHeading('Attestation(s) Created', 3)
core.summary.write()
}

Expand Down

0 comments on commit 495f094

Please sign in to comment.