From 60c5cc56a231b30df5a217e741a3bb9189d550bc Mon Sep 17 00:00:00 2001 From: deef Date: Sat, 12 Jul 2025 19:14:43 -0500 Subject: [PATCH] Dont override prometheus gateway path if already set If the gateway path name is not an empty string, "/" or "/metrics", it will remain unchanged prometheus gateways --- src/metrics/github.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/metrics/github.ts b/src/metrics/github.ts index d6c3fee..9aa29f5 100644 --- a/src/metrics/github.ts +++ b/src/metrics/github.ts @@ -25,8 +25,10 @@ export function getMetricsUrl() { const parsed = new URL(gateway); const type = process.env.INPUT_GATEWAYTYPE; if (type === "prometheus") { - const labels = getLabels(); - parsed.pathname = `/metrics/job/${labels.job}/workflow/${labels.workflow}`; + if (!parsed.pathname || parsed.pathname === "" || parsed.pathname === "/" || parsed.pathname === "/metrics") { + const labels = getLabels(); + parsed.pathname = `/metrics/job/${labels.job}/workflow/${labels.workflow}`; + } } else if (parsed.pathname !== "/metrics") { parsed.pathname = "/metrics"; }