From 15916800df051ff24b89c0f961260e8bea28d85f Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Wed, 1 Oct 2025 15:55:20 +0100 Subject: [PATCH] Send a basic status report in `start-proxy` Action if it succeeds --- lib/start-proxy-action.js | 14 ++++++++++++++ src/start-proxy-action.ts | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 30dea89f7..2929235de 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -95752,6 +95752,19 @@ function generateCertificateAuthority() { const key = import_node_forge.pki.privateKeyToPem(keys.privateKey); return { cert: pem, key }; } +async function sendSuccessStatusReport(startedAt, logger) { + const statusReportBase = await createStatusReportBase( + "start-proxy" /* StartProxy */, + "success", + startedAt, + void 0, + await checkDiskUsage(logger), + logger + ); + if (statusReportBase !== void 0) { + await sendStatusReport(statusReportBase); + } +} async function runWrapper() { const startedAt = /* @__PURE__ */ new Date(); persistInputs(); @@ -95781,6 +95794,7 @@ async function runWrapper() { }; const proxyBin = await getProxyBinaryPath(logger); await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger); + await sendSuccessStatusReport(startedAt, logger); } catch (unwrappedError) { const error2 = wrapError(unwrappedError); core11.setFailed(`start-proxy action failed: ${error2.message}`); diff --git a/src/start-proxy-action.ts b/src/start-proxy-action.ts index 1127700f9..867e76142 100644 --- a/src/start-proxy-action.ts +++ b/src/start-proxy-action.ts @@ -89,6 +89,20 @@ function generateCertificateAuthority(): CertificateAuthority { return { cert: pem, key }; } +async function sendSuccessStatusReport(startedAt: Date, logger: Logger) { + const statusReportBase = await createStatusReportBase( + ActionName.StartProxy, + "success", + startedAt, + undefined, + await util.checkDiskUsage(logger), + logger, + ); + if (statusReportBase !== undefined) { + await sendStatusReport(statusReportBase); + } +} + async function runWrapper() { const startedAt = new Date(); @@ -132,6 +146,9 @@ async function runWrapper() { // Start the Proxy const proxyBin = await getProxyBinaryPath(logger); await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger); + + // Report success if we have reached this point. + await sendSuccessStatusReport(startedAt, logger); } catch (unwrappedError) { const error = util.wrapError(unwrappedError); core.setFailed(`start-proxy action failed: ${error.message}`);