From ae3f3b612731393cddcca4b6df4f029c80ed3ac0 Mon Sep 17 00:00:00 2001 From: mkorwel Date: Thu, 16 Apr 2026 15:28:00 +0000 Subject: [PATCH] ci: remove mac job and improve CI polling logic --- .gemini/skills/ci/scripts/ci.mjs | 30 ++++++++++++++++--------- .github/workflows/ci-bundling-trial.yml | 14 ------------ 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/.gemini/skills/ci/scripts/ci.mjs b/.gemini/skills/ci/scripts/ci.mjs index 9073285231..e3434d0b1a 100755 --- a/.gemini/skills/ci/scripts/ci.mjs +++ b/.gemini/skills/ci/scripts/ci.mjs @@ -103,25 +103,33 @@ async function monitor() { if (RUN_ID_OVERRIDE) { targetRunIds = [RUN_ID_OVERRIDE]; } else { - // 1. Get runs directly associated with the branch + const headCommitTime = parseInt( + execSync(`git log -1 --format=%ct "${BRANCH}"`).toString().trim(), + 10, + ) * 1000; + + // 1. Get recent runs associated with the branch, taking only the latest per unique workflow const runListOutput = runGh( - `run list --branch "${BRANCH}" --limit 10 --json databaseId,status,workflowName,createdAt`, + `run list --branch "${BRANCH}" --limit 30 --json databaseId,status,workflowName,createdAt`, ); if (runListOutput) { - const runs = JSON.parse(runListOutput); - const activeRuns = runs.filter((r) => r.status !== 'completed'); - if (activeRuns.length > 0) { - targetRunIds = activeRuns.map((r) => r.databaseId); - } else if (runs.length > 0) { - const latestTime = new Date(runs[0].createdAt).getTime(); - targetRunIds = runs - .filter((r) => latestTime - new Date(r.createdAt).getTime() < 60000) - .map((r) => r.databaseId); + const runs = JSON.parse(runListOutput).filter( + (r) => new Date(r.createdAt).getTime() >= headCommitTime - 30000, + ).sort( + (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(), + ); + const seenWorkflows = new Set(); + for (const r of runs) { + if (!seenWorkflows.has(r.workflowName)) { + seenWorkflows.add(r.workflowName); + targetRunIds.push(r.databaseId); + } } } // 2. Get runs associated with commit statuses (handles chained/indirect runs) try { + const headSha = execSync(`git rev-parse "${BRANCH}"`).toString().trim(); const statusOutput = runGh( `api repos/${REPO}/commits/${headSha}/status -q '.statuses[] | select(.target_url | contains("actions/runs/")) | .target_url'`, diff --git a/.github/workflows/ci-bundling-trial.yml b/.github/workflows/ci-bundling-trial.yml index b6a6ea65a6..92345badd1 100644 --- a/.github/workflows/ci-bundling-trial.yml +++ b/.github/workflows/ci-bundling-trial.yml @@ -47,21 +47,7 @@ jobs: run: 'npx vitest run packages/cli' shell: 'bash' - test_mac: - name: 'Test (Mac) - CLI Unit' - runs-on: 'macos-large-latest' - steps: - - name: 'Checkout' - uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' - - name: 'Setup and Build' - uses: './.github/actions/setup-gemini' - with: - mode: 'source' - - - name: 'Run CLI Unit Tests' - run: 'npx vitest run packages/cli' - shell: 'bash' test_windows: name: 'Test (Windows) - CLI Unit'