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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user