From 348257c874457aa979bd08902e9667ad4e1b6bcf Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Mon, 16 Jun 2025 11:15:10 +0100 Subject: [PATCH] Add sha and ref snapshot inputs --- action.yml | 6 ++++++ index.ts | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/action.yml b/action.yml index 99872b1..c9b856f 100644 --- a/action.yml +++ b/action.yml @@ -36,6 +36,12 @@ inputs: detector-url: description: 'The URL of the detector. If provided, detector-name and detector-version must also be provided.' required: false + snapshot-sha: + description: 'The SHA of the commit to associate with the snapshot. If provided, snapshot-ref must also be provided.' + required: false + snapshot-ref: + description: 'The Git reference to associate with the snapshot. If provided, snapshot-sha must also be provided.' + required: false runs: using: 'node20' main: 'dist/index.js' diff --git a/index.ts b/index.ts index cc8f0e3..6aa47e4 100644 --- a/index.ts +++ b/index.ts @@ -60,6 +60,18 @@ async function run() { snapshot.addManifest(manifest); }); + // Override snapshot ref and sha if provided + const snapshotSha = core.getInput("snapshot-sha")?.trim(); + const snapshotRef = core.getInput("snapshot-ref")?.trim(); + + if (snapshotSha) { + snapshot.sha = snapshotSha; + } + + if (snapshotRef) { + snapshot.ref = snapshotRef; + } + submitSnapshot(snapshot); }