From c9c237178ec5ce78a3b7b6ffcf7f6ed8ac70c509 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Mon, 18 May 2026 11:15:10 -0400 Subject: [PATCH] fix(ci): clarify selective E2E scorecards --- .github/workflows/nightly-e2e.yaml | 97 ++++++++++++++++++------------ 1 file changed, 60 insertions(+), 37 deletions(-) diff --git a/.github/workflows/nightly-e2e.yaml b/.github/workflows/nightly-e2e.yaml index 1d350560cbf..12dea245995 100644 --- a/.github/workflows/nightly-e2e.yaml +++ b/.github/workflows/nightly-e2e.yaml @@ -2332,6 +2332,17 @@ jobs: // ── Gather results from the current run's needs context ─ const needs = ${{ toJSON(needs) }}; const today = formatDate(new Date()); + const isDispatch = context.eventName === 'workflow_dispatch'; + const requestedJobsRaw = isDispatch ? '${{ inputs.jobs }}'.trim() : ''; + const requestedJobs = requestedJobsRaw + ? requestedJobsRaw.split(',').map((name) => name.trim()).filter(Boolean) + : []; + const isSelectiveDispatch = isDispatch && requestedJobs.length > 0; + const runMode = isSelectiveDispatch + ? 'Selective dispatch' + : isDispatch + ? 'Manual full run' + : 'Scheduled full nightly'; const entries = Object.entries(needs).filter(([name]) => !EXCLUDED_JOBS.has(name)); let success = 0; @@ -2358,45 +2369,49 @@ jobs: // ── Fetch prior-day run for trend comparison ──────────── let trendLine = ''; - try { - const WORKFLOW_FILE = 'nightly-e2e.yaml'; - const now = new Date(); - const since48h = new Date(now.getTime() - 48 * 60 * 60 * 1000).toISOString(); - const since24h = new Date(now.getTime() - 24 * 60 * 60 * 1000).toISOString(); - - const { data } = await github.rest.actions.listWorkflowRuns({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: WORKFLOW_FILE, - created: `>=${since48h}`, - per_page: 50, - }); - - // Find completed scheduled runs from 24–48h ago - const priorRuns = data.workflow_runs.filter(r => - r.status === 'completed' && - r.event === 'schedule' && - new Date(r.created_at) < new Date(since24h) - ); - - if (priorRuns.length > 0) { - // Check the most recent prior run - const priorRun = priorRuns[0]; - const priorPerfect = priorRun.conclusion === 'success'; - if (perfect && priorPerfect) { - trendLine = 'Trend: ➡️ Stable (perfect both days)'; - } else if (perfect && !priorPerfect) { - trendLine = 'Trend: ↗️ Improving (yesterday had failures → today perfect)'; - } else if (!perfect && priorPerfect) { - trendLine = 'Trend: ↘️ Degrading (yesterday perfect → today has failures)'; + if (isSelectiveDispatch) { + trendLine = 'Trend: ⊘ Not shown for selective dispatches'; + } else { + try { + const WORKFLOW_FILE = 'nightly-e2e.yaml'; + const now = new Date(); + const since48h = new Date(now.getTime() - 48 * 60 * 60 * 1000).toISOString(); + const since24h = new Date(now.getTime() - 24 * 60 * 60 * 1000).toISOString(); + + const { data } = await github.rest.actions.listWorkflowRuns({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: WORKFLOW_FILE, + created: `>=${since48h}`, + per_page: 50, + }); + + // Find completed scheduled runs from 24–48h ago + const priorRuns = data.workflow_runs.filter(r => + r.status === 'completed' && + r.event === 'schedule' && + new Date(r.created_at) < new Date(since24h) + ); + + if (priorRuns.length > 0) { + // Check the most recent prior run + const priorRun = priorRuns[0]; + const priorPerfect = priorRun.conclusion === 'success'; + if (perfect && priorPerfect) { + trendLine = 'Trend: ➡️ Stable (perfect both days)'; + } else if (perfect && !priorPerfect) { + trendLine = 'Trend: ↗️ Improving (yesterday had failures → today perfect)'; + } else if (!perfect && priorPerfect) { + trendLine = 'Trend: ↘️ Degrading (yesterday perfect → today has failures)'; + } else { + trendLine = 'Trend: ➡️ Stable (failures both days)'; + } } else { - trendLine = 'Trend: ➡️ Stable (failures both days)'; + trendLine = 'Trend: ⊘ No prior-day data for comparison'; } - } else { - trendLine = 'Trend: ⊘ No prior-day data for comparison'; + } catch (e) { + trendLine = `Trend: ⊘ Could not fetch prior-day data (${e.message})`; } - } catch (e) { - trendLine = `Trend: ⊘ Could not fetch prior-day data (${e.message})`; } // ── Build scorecard ───────────────────────────────────── @@ -2404,12 +2419,20 @@ jobs: const lines = [ `## 🌅 NemoClaw Nightly Scorecard — ${today}`, '', + `**Run mode:** ${runMode}`, + ]; + + if (isSelectiveDispatch) { + lines.push(`**Requested jobs:** ${requestedJobs.map((name) => `\`${name}\``).join(', ')}`); + } + + lines.push( `**Jobs run:** ${ran} of ${total}`, ` ✅ ${success} passed`, ` ❌ ${failure} failed`, ` ⊘ ${cancelled} cancelled`, ` ⏭️ ${skipped} skipped`, - ]; + ); if (failedJobs.length > 0) { lines.push('');