From aa37531e2badd2d84e7a4225371e7d52ef996fec Mon Sep 17 00:00:00 2001 From: "E. Lynette Rayle" Date: Thu, 29 May 2025 19:01:50 +0000 Subject: [PATCH] make sure sha and ref are only overwritten if a value was passed in --- src/index.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 27b0e7c..990a4c4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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) }