tweak summary output (#43)

Signed-off-by: Brian DeHamer <[email protected]>
This commit is contained in:
Brian DeHamer
2024-04-26 13:23:19 -07:00
committed by GitHub
parent f7a204b420
commit 495f094150
2 changed files with 25 additions and 9 deletions
Generated Vendored
+9 -3
View File
@@ -79657,6 +79657,7 @@ async function run() {
? 'public-good' ? 'public-good'
: 'github'; : 'github';
try { try {
const atts = [];
if (!process.env.ACTIONS_ID_TOKEN_REQUEST_URL) { if (!process.env.ACTIONS_ID_TOKEN_REQUEST_URL) {
throw new Error('missing "id-token" permission. Please add "permissions: id-token: write" to your workflow.'); throw new Error('missing "id-token" permission. Please add "permissions: id-token: write" to your workflow.');
} }
@@ -79673,11 +79674,16 @@ async function run() {
flag: 'a' flag: 'a'
}); });
if (att.attestationID) { if (att.attestationID) {
core.summary.addLink(`${subject.name}@${subjectDigest(subject)}`, attestationURL(att.attestationID)); atts.push({ subject, attestationID: att.attestationID });
} }
} }
if (!core.summary.isEmptyBuffer()) { if (atts.length > 0) {
core.summary.addHeading('Attestation(s) Created', 3); 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(attestationID));
}
core.summary.write(); core.summary.write();
} }
core.setOutput('bundle-path', outputPath); core.setOutput('bundle-path', outputPath);
+16 -6
View File
@@ -10,6 +10,7 @@ import { predicateFromInputs } from './predicate'
import { subjectFromInputs } from './subject' import { subjectFromInputs } from './subject'
type SigstoreInstance = 'public-good' | 'github' type SigstoreInstance = 'public-good' | 'github'
type AttestedSubject = { subject: Subject; attestationID: string }
const COLOR_CYAN = '\x1B[36m' const COLOR_CYAN = '\x1B[36m'
const COLOR_DEFAULT = '\x1B[39m' const COLOR_DEFAULT = '\x1B[39m'
@@ -30,6 +31,7 @@ export async function run(): Promise<void> {
: 'github' : 'github'
try { try {
const atts: AttestedSubject[] = []
if (!process.env.ACTIONS_ID_TOKEN_REQUEST_URL) { if (!process.env.ACTIONS_ID_TOKEN_REQUEST_URL) {
throw new Error( throw new Error(
'missing "id-token" permission. Please add "permissions: id-token: write" to your workflow.' 'missing "id-token" permission. Please add "permissions: id-token: write" to your workflow.'
@@ -52,15 +54,23 @@ export async function run(): Promise<void> {
}) })
if (att.attestationID) { if (att.attestationID) {
core.summary.addLink( atts.push({ subject, attestationID: att.attestationID })
`${subject.name}@${subjectDigest(subject)}`,
attestationURL(att.attestationID)
)
} }
} }
if (!core.summary.isEmptyBuffer()) { if (atts.length > 0) {
core.summary.addHeading('Attestation(s) Created', 3) 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(attestationID)
)
}
core.summary.write() core.summary.write()
} }