flip if-else logic for creating storage records to remove nesting

Signed-off-by: Meredith Lancaster <[email protected]>
This commit is contained in:
Meredith Lancaster
2026-01-26 11:32:34 -08:00
parent e36bd1a2fc
commit 309649c98d
+5 -2
View File
@@ -68,10 +68,14 @@ export const createAttestation = async (
// Add the attestation's digest to the result
result.attestationDigest = artifact.digest
// If createStorageRecord is false, return early
if (!opts.createStorageRecord) {
return result
}
// Because creating a storage record requires the 'artifact-metadata:write'
// permission, we wrap this in a try/catch to avoid failing the entire
// attestation process if the token does not have the correct permissions.
if (opts.createStorageRecord) {
try {
const token = opts.githubToken
const isOrg = await repoOwnerIsOrg(token)
@@ -107,7 +111,6 @@ export const createAttestation = async (
'Please check that the "artifact-metadata:write" permission has been included'
)
}
}
return result
}