From 29dceec5ce2fca4f53763952163dc07a3e1a14b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BF=AE=E9=9B=A8?= <47820304+PeterGuy326@users.noreply.github.com> Date: Tue, 21 Jul 2026 18:48:03 +0800 Subject: [PATCH] fix(release): check commit statuses in Code Admission gates (#732) The "AI Behavior" context is reported as a commit status (via github.rest.repos.createCommitStatus) rather than a check run, but the Code Admission gates only queried check runs via github.rest.checks.listForRef. This caused every release to fail with "missing: AI Behavior" since the context was never found. Add a commit-status query after the check-run loop in both the preflight and sealed-commit Code Admission gates. Statuses are merged only for required contexts not already covered by a check run, preserving the existing check-run precedence. --- .github/workflows/release.yml | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1ea442f8..93cee5f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -358,6 +358,25 @@ jobs: latestByName.set(run.name, run); } } + // Also check commit statuses — some contexts (e.g. "AI Behavior") + // are reported as commit statuses rather than check runs. + const statuses = await github.paginate( + github.rest.repos.listCommitStatusesForRef, + { owner, repo, ref: sha, per_page: 100 }, + ); + const seenStatusContexts = new Set(); + for (const status of statuses) { + if (!requiredContexts.includes(status.context) || seenStatusContexts.has(status.context)) { + continue; + } + seenStatusContexts.add(status.context); + if (!latestByName.has(status.context)) { + latestByName.set(status.context, { + conclusion: status.state, + status: "completed", + }); + } + } const missing = requiredContexts.filter((name) => !latestByName.has(name)); const nonSuccess = requiredContexts.flatMap((name) => { const run = latestByName.get(name); @@ -753,6 +772,25 @@ jobs: latestByName.set(run.name, run); } } + // Also check commit statuses — some contexts (e.g. "AI Behavior") + // are reported as commit statuses rather than check runs. + const statuses = await github.paginate( + github.rest.repos.listCommitStatusesForRef, + { owner, repo, ref: sha, per_page: 100 }, + ); + const seenStatusContexts = new Set(); + for (const status of statuses) { + if (!requiredContexts.includes(status.context) || seenStatusContexts.has(status.context)) { + continue; + } + seenStatusContexts.add(status.context); + if (!latestByName.has(status.context)) { + latestByName.set(status.context, { + conclusion: status.state, + status: "completed", + }); + } + } const missing = requiredContexts.filter((name) => !latestByName.has(name)); const nonSuccess = requiredContexts.flatMap((name) => { const run = latestByName.get(name);