From e7af3a9e58a171d509a7a02dd0f84f1fb474e237 Mon Sep 17 00:00:00 2001 From: sthings user Date: Mon, 18 May 2026 12:34:52 +0000 Subject: [PATCH] feat(comment-preview-url): add additional-urls input for co-tenant review surfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an optional `additional-urls` input that takes a comma-separated list of `Label=URL` pairs and appends them as extra rows in the preview comment table. Motivated by stuttgart-things/homerun2-git-pitcher's PR-preview shape: git-pitcher itself exposes only /health and /metrics, but the events it produces are reviewed via a co-tenanted core-catcher dashboard at a separate hostname. Without this, the preview comment only points at git-pr-.… (no UI) and reviewers have to guess at cc-git-pr-.… Existing callers (omni-pitcher, demo-pitcher, scout, core-catcher) are unaffected — input defaults to empty string and the extra-rows block collapses to nothing. Caller usage: additional-urls: 'Dashboard=https://cc-git-pr-${{ github.event.number }}.…' Refs stuttgart-things/homerun2-git-pitcher#25 Co-Authored-By: Claude Opus 4.7 (1M context) --- .../workflows/call-comment-preview-url.yaml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/call-comment-preview-url.yaml b/.github/workflows/call-comment-preview-url.yaml index c318eea..ef0a614 100644 --- a/.github/workflows/call-comment-preview-url.yaml +++ b/.github/workflows/call-comment-preview-url.yaml @@ -38,6 +38,19 @@ on: default: /health type: string description: "Service health endpoint path appended to the preview URL." + additional-urls: + default: "" + type: string + description: | + Optional comma-separated `Label=URL` pairs to append as extra rows + in the comment table. Useful when the SUT's hostname isn't the + actual review surface — e.g. git-pitcher exposes only /health + and /metrics, but the events it produces are reviewed via a + co-tenanted core-catcher dashboard. The caller can interpolate + `${{ github.event.number }}` into the URL. + + Example: + additional-urls: 'Dashboard=https://cc-git-pr-${{ github.event.number }}.homerun2-dev.example.com' permissions: pull-requests: write @@ -54,18 +67,32 @@ jobs: ARGOCD_APP_PREFIX: ${{ inputs.argocd-app-prefix }} ARGOCD_BASE_URL: ${{ inputs.argocd-base-url }} HEALTH_PATH: ${{ inputs.health-path }} + ADDITIONAL_URLS: ${{ inputs.additional-urls }} with: script: | const num = context.issue.number; const { HOSTNAME_PREFIX, HOSTNAME_DOMAIN, NAMESPACE_PREFIX, ARGOCD_APP_PREFIX, ARGOCD_BASE_URL, HEALTH_PATH, + ADDITIONAL_URLS, } = process.env; const appPrefix = ARGOCD_APP_PREFIX || NAMESPACE_PREFIX; const url = `https://${HOSTNAME_PREFIX}-${num}.${HOSTNAME_DOMAIN}`; const ns = `${NAMESPACE_PREFIX}-${num}`; const app = `${appPrefix}-${num}`; const argo = `https://${ARGOCD_BASE_URL}/applications?search=${app}`; + const extraRows = (ADDITIONAL_URLS || "") + .split(",") + .map(s => s.trim()) + .filter(s => s.length > 0) + .map(s => { + const eq = s.indexOf("="); + if (eq < 0) return null; + const label = s.slice(0, eq).trim(); + const value = s.slice(eq + 1).trim(); + return `| ${label} | ${value} |`; + }) + .filter(Boolean); const marker = ""; const body = [ marker, @@ -75,6 +102,7 @@ jobs: `|--|--|`, `| URL | ${url} |`, `| Health | ${url}${HEALTH_PATH} |`, + ...extraRows, `| Namespace | \`${ns}\` |`, `| ArgoCD | [\`${app}\`](${argo}) |`, "",