make sure sha and ref are only overwritten if a value was passed in

This commit is contained in:
E. Lynette Rayle
2025-05-29 19:01:50 +00:00
parent ced71b5163
commit aa37531e2b

View File

@@ -118,8 +118,18 @@ async function main () {
id: github.context.runId.toString()
})
snapshot.addManifest(manifest)
snapshot.sha = core.getInput('snapshot-sha')
snapshot.ref = core.getInput('snapshot-ref')
const inputSHA = core.getInput('sha')
if (inputSHA !== '') {
// only set the SHA if it is not empty; otherwise, use the SHA from the context
snapshot.sha = inputSHA
}
const inputRef = core.getInput('ref')
if (inputRef !== '') {
// only set the ref if it is not empty; otherwise, use the ref from the context
snapshot.ref = inputRef
}
submitSnapshot(snapshot)
}