Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support single-subject attestations #219

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Introduce logSubjects()
  • Loading branch information
AA-Turner committed Mar 4, 2025
commit 0b37d8a45b0b35c3e729d5a4c91a946f6b77792b
23 changes: 13 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@
}

for (const att of atts) {
logAttestation(subjects, att, sigstoreInstance)
logAttestation(att, sigstoreInstance)

// Write attestation bundle to output file
fs.writeFileSync(outputPath, JSON.stringify(att.bundle) + os.EOL, {
@@ -95,6 +95,8 @@
})
}

logSubjects(subjects)

if (atts[0].attestationID) {
core.setOutput('attestation-id', atts[0].attestationID)
core.setOutput('attestation-url', attestationURL(atts[0].attestationID))
@@ -126,18 +128,9 @@

// Log details about the attestation to the GitHub Actions run
const logAttestation = (
subjects: Subject[],
attestation: AttestResult,
sigstoreInstance: SigstoreInstance
): void => {
if (subjects.length === 1) {
core.info(
`Attestation created for ${subjects[0].name}@${formatSubjectDigest(subjects[0])}`
)
} else {
core.info(`Attestation created for ${subjects.length} subjects`)
}

const instanceName =
sigstoreInstance === 'public-good' ? 'Public Good' : 'GitHub'
core.startGroup(
@@ -164,10 +157,20 @@

if (attestation.attestationDigest) {
core.info(style.highlight('Attestation uploaded to registry'))
core.info(`${subjects[0].name}@${attestation.attestationDigest}`)

Check failure on line 160 in src/main.ts

GitHub Actions / TypeScript Tests

Unsafe member access [0] on an `error` typed value
}
}

// Log details about attestation subjects to the GitHub Actions run
const logSubjects = (subjects: Subject[]): void => {
core.info(`Attestation created for ${subjects.length} subjects`)
for (const subject of subjects) {
core.info(
`Attestation created for ${subject.name}@${formatSubjectDigest(subject)}`
)
}
}

// Attach summary information to the GitHub Actions run
const logSummary = async (attestations: AttestResult[]): Promise<void> => {
if (attestations.length <= 0) return
Loading
Oops, something went wrong.