@@ -2080,10 +2080,66 @@ function dashboardPublicBayReferences(value) {
20802080 const key = repository + "#" + itemNumber;
20812081 if (seen.has(key)) continue;
20822082 seen.add(key);
2083- references.push({ repository, item_number: itemNumber, stage: entry.stage, source: entry.source });
2083+ const action = dashboardPublicBayAction(entry.action);
2084+ references.push({
2085+ repository,
2086+ item_number: itemNumber,
2087+ stage: entry.stage,
2088+ source: entry.source,
2089+ ...(action ? { action } : {})
2090+ });
20842091 }
20852092 return references;
20862093}
2094+ const PUBLIC_ACTION_STEP_LABELS = {
2095+ setup: "Set up job",
2096+ checkout: "Check out repository",
2097+ dependencies: "Prepare dependencies",
2098+ lease: "Acquire work lease",
2099+ review: "Run review",
2100+ proof: "Verify proof",
2101+ test: "Run checks",
2102+ publish: "Publish result",
2103+ apply: "Apply result",
2104+ finalize: "Finalize",
2105+ cleanup: "Clean up",
2106+ workflow: "Workflow step"
2107+ };
2108+ function dashboardPublicBayAction(value) {
2109+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
2110+ const repository = typeof value.repository === "string" ? value.repository.trim().toLowerCase() : "";
2111+ const runId = value.run_id;
2112+ const jobId = value.job_id;
2113+ const statuses = new Set(["queued", "in_progress", "completed"]);
2114+ const conclusions = new Set(["success", "failure", "cancelled", "skipped", "neutral", "timed_out", "action_required", "startup_failure", "stale"]);
2115+ const startedAt = value.started_at === null ? null : dashboardObservabilityTimestamp(value.started_at);
2116+ if (
2117+ repository.length > 200 ||
2118+ !/^[a-z0-9_.-]+\\/[a-z0-9_.-]+$/.test(repository) ||
2119+ typeof runId !== "number" || !Number.isSafeInteger(runId) || runId <= 0 || runId > 1000000000000000 ||
2120+ (jobId !== undefined && (typeof jobId !== "number" || !Number.isSafeInteger(jobId) || jobId <= 0 || jobId > 1000000000000000)) ||
2121+ !statuses.has(value.status) ||
2122+ (value.started_at !== null && !startedAt) ||
2123+ typeof value.steps_complete !== "boolean" ||
2124+ !Array.isArray(value.steps) || value.steps.length > 100
2125+ ) return null;
2126+ const steps = [];
2127+ const seen = new Set();
2128+ for (const step of value.steps) {
2129+ if (!step || typeof step !== "object" || Array.isArray(step)) return null;
2130+ if (
2131+ typeof step.sequence !== "number" || !Number.isSafeInteger(step.sequence) || step.sequence <= 0 || step.sequence > 1000 || seen.has(step.sequence) ||
2132+ !Object.hasOwn(PUBLIC_ACTION_STEP_LABELS, step.kind) ||
2133+ !statuses.has(step.status) ||
2134+ (step.conclusion !== null && !conclusions.has(step.conclusion))
2135+ ) return null;
2136+ seen.add(step.sequence);
2137+ steps.push({ sequence: step.sequence, kind: step.kind, status: step.status, conclusion: step.conclusion });
2138+ }
2139+ if ((!value.steps_complete && steps.length) || (value.steps_complete && steps.length !== value.steps.length)) return null;
2140+ steps.sort((left, right) => left.sequence - right.sequence);
2141+ return { repository, run_id: runId, ...(jobId === undefined ? {} : { job_id: jobId }), status: value.status, started_at: startedAt, steps_complete: value.steps_complete, steps };
2142+ }
20872143function dashboardStatusSnapshot(value) {
20882144 if (!value || typeof value !== "object" || Array.isArray(value)) return null;
20892145 const projected = dashboardStatusValue(value, "root", 0);
@@ -3667,6 +3723,14 @@ function renderPublicReferenceDialog(row, key) {
36673723 const repositoryUrl = "https://github.com/" + row.repository;
36683724 const itemUrl = repositoryUrl + "/issues/" + row.item_number;
36693725 const source = row.source === "queue" ? "Bounded queue sample" : "Bounded live sample";
3726+ const action = dashboardPublicBayAction(row.action);
3727+ const completedSteps = action ? action.steps.filter(step => step.status === "completed").length : 0;
3728+ const actionRepositoryUrl = action ? "https://github.com/" + action.repository : null;
3729+ const runUrl = action ? actionRepositoryUrl + "/actions/runs/" + action.run_id : null;
3730+ const jobUrl = action?.job_id ? runUrl + "/job/" + action.job_id : null;
3731+ const stepRows = action?.steps.map(step =>
3732+ '<li class="step-row ' + esc(step.status) + '"><i class="step-mark"></i><strong>' + esc(PUBLIC_ACTION_STEP_LABELS[step.kind]) + '</strong><span>' + esc((step.conclusion || step.status).replaceAll("_", " ")) + '</span></li>'
3733+ ).join("") || "";
36703734 document.getElementById("worker-dialog-heading").innerHTML =
36713735 '<div><span class="pill">' + esc(row.source) + '</span> <span class="pill">' + esc(row.stage) + '</span></div>' +
36723736 '<h3 id="worker-dialog-title">' + esc(key) + '</h3>' +
@@ -3677,13 +3741,17 @@ function renderPublicReferenceDialog(row, key) {
36773741 '<div class="drawer-stat"><span>Source</span><strong>' + esc(source) + '</strong></div>' +
36783742 '<div class="drawer-stat"><span>Repository</span><strong>' + esc(row.repository) + '</strong></div>' +
36793743 '<div class="drawer-stat"><span>Reference</span><strong>#' + esc(row.item_number) + '</strong></div>' +
3744+ (action ? '<div class="drawer-stat"><span>Action status</span><strong>' + esc(action.status.replaceAll("_", " ")) + '</strong></div>' : '') +
3745+ (action ? '<div class="drawer-stat"><span>Progress</span><strong>' + esc(completedSteps) + ' / ' + esc(action.steps.length) + ' steps</strong></div>' : '') +
36803746 '</div>' +
36813747 '<div class="drawer-links">' +
36823748 linkClass(itemUrl, "Open issue or pull request", "pill run-link") +
36833749 linkClass(repositoryUrl, "Open repository", "pill run-link") +
3750+ linkClass(jobUrl, "Open job", "pill run-link") +
3751+ linkClass(runUrl, "Open workflow run", "pill run-link") +
36843752 '</div>' +
3685- '<h2>Public status</h2>' +
3686- '<ol class="step-list">< li class="step-row"><i class="step-mark"></i><strong>Reference verified</strong><span>Public repository and item coordinates only </span></li><li class="step-row in_progress"><i class="step-mark"></i><strong>Current aggregate stage</strong><span>' + esc(row.stage) + '</span></li></ol>';
3753+ '<h2>' + (action ? 'Step timeline' : ' Public status') + ' </h2>' +
3754+ (stepRows ? '<ol class="step-list">' + stepRows + '</ol>' : '<ol class="step-list">< li class="step-row completed "><i class="step-mark"></i><strong>Reference verified</strong><span>Verified public GitHub coordinates</span></li><li class="step-row in_progress"><i class="step-mark"></i><strong>Current Bay stage</strong><span>' + esc(row.stage) + '</span></li></ol>') ;
36873755 if (!dialog.open) dialog.showModal();
36883756 history.replaceState(null, "", "#public-reference-" + encodeURIComponent(key));
36893757}
0 commit comments