Merge pull request #1863 from meriadec/attest-provenance-tags

Handle tags containing "@" character in `buildSLSAProvenancePredicate`
This commit is contained in:
Brian DeHamer
2024-11-01 09:35:13 -07:00
committed by GitHub
3 changed files with 68 additions and 10 deletions

View File

@@ -30,9 +30,11 @@ export const buildSLSAProvenancePredicate = async (
// Split just the path and ref from the workflow string.
// owner/repo/.github/workflows/main.yml@main =>
// .github/workflows/main.yml, main
const [workflowPath, workflowRef] = claims.workflow_ref
const [workflowPath, ...workflowRefChunks] = claims.workflow_ref
.replace(`${claims.repository}/`, '')
.split('@')
// Handle case where tag contains `@` (e.g: when using changesets in a monorepo context),
const workflowRef = workflowRefChunks.join('@')
return {
type: SLSA_PREDICATE_V1_TYPE,