From d573787cca00bdd533d895012a2af0dad5f2e66a Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Wed, 1 Oct 2025 16:00:05 +0100 Subject: [PATCH] Report registry types that are configured for CodeQL in `start-proxy` telemetry --- lib/start-proxy-action.js | 14 +++++++++++--- src/start-proxy-action.ts | 25 ++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 2929235de..95a33cc3a 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -95752,7 +95752,7 @@ function generateCertificateAuthority() { const key = import_node_forge.pki.privateKeyToPem(keys.privateKey); return { cert: pem, key }; } -async function sendSuccessStatusReport(startedAt, logger) { +async function sendSuccessStatusReport(startedAt, registry_types, logger) { const statusReportBase = await createStatusReportBase( "start-proxy" /* StartProxy */, "success", @@ -95762,7 +95762,11 @@ async function sendSuccessStatusReport(startedAt, logger) { logger ); if (statusReportBase !== void 0) { - await sendStatusReport(statusReportBase); + const statusReport = { + ...statusReportBase, + registry_types: registry_types.join(",") + }; + await sendStatusReport(statusReport); } } async function runWrapper() { @@ -95794,7 +95798,11 @@ async function runWrapper() { }; const proxyBin = await getProxyBinaryPath(logger); await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger); - await sendSuccessStatusReport(startedAt, logger); + await sendSuccessStatusReport( + startedAt, + proxyConfig.all_credentials.map((c) => c.type), + 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 867e76142..966c954b4 100644 --- a/src/start-proxy-action.ts +++ b/src/start-proxy-action.ts @@ -19,6 +19,7 @@ import { createStatusReportBase, getActionsStatus, sendStatusReport, + StatusReportBase, } from "./status-report"; import * as util from "./util"; @@ -89,7 +90,17 @@ function generateCertificateAuthority(): CertificateAuthority { return { cert: pem, key }; } -async function sendSuccessStatusReport(startedAt: Date, logger: Logger) { +interface StartProxyStatus extends StatusReportBase { + // A comma-separated list of registry types which are configured for CodeQL. + // This only includes registry types we support, not all that are configured. + registry_types: string; +} + +async function sendSuccessStatusReport( + startedAt: Date, + registry_types: string[], + logger: Logger, +) { const statusReportBase = await createStatusReportBase( ActionName.StartProxy, "success", @@ -99,7 +110,11 @@ async function sendSuccessStatusReport(startedAt: Date, logger: Logger) { logger, ); if (statusReportBase !== undefined) { - await sendStatusReport(statusReportBase); + const statusReport: StartProxyStatus = { + ...statusReportBase, + registry_types: registry_types.join(","), + }; + await sendStatusReport(statusReport); } } @@ -148,7 +163,11 @@ async function runWrapper() { await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger); // Report success if we have reached this point. - await sendSuccessStatusReport(startedAt, logger); + await sendSuccessStatusReport( + startedAt, + proxyConfig.all_credentials.map((c) => c.type), + logger, + ); } catch (unwrappedError) { const error = util.wrapError(unwrappedError); core.setFailed(`start-proxy action failed: ${error.message}`);