mirror of
https://github.com/actions/attest-build-provenance.git
synced 2025-12-16 20:30:59 +00:00
21 lines
663 B
TypeScript
21 lines
663 B
TypeScript
import { buildSLSAProvenancePredicate } from '@actions/attest'
|
|
import * as core from '@actions/core'
|
|
|
|
/**
|
|
* The main function for the action.
|
|
* @returns {Promise<void>} Resolves when the action is complete.
|
|
*/
|
|
export async function run(): Promise<void> {
|
|
try {
|
|
// Calculate subject from inputs and generate provenance
|
|
const predicate = await buildSLSAProvenancePredicate()
|
|
|
|
core.setOutput('predicate', predicate.params)
|
|
core.setOutput('predicate-type', predicate.type)
|
|
} catch (err) {
|
|
const error = err instanceof Error ? err : new Error(`${err}`)
|
|
// Fail the workflow run if an error occurs
|
|
core.setFailed(error.message)
|
|
}
|
|
}
|