[CI] Fix base-a wait for skipped CPU matrix (#39195)

This commit is contained in:
Baizhou Zhang
2026-09-11 23:39:53 -07:00
committed by GitHub
parent 3bb2a5231a
commit 56a4f47ca6
+7 -7
View File
@@ -182,15 +182,15 @@ runs:
if (matchingJobs.length < spec.expected_count) { if (matchingJobs.length < spec.expected_count) {
// Job-level `if:` is evaluated before matrix expansion. When it // Job-level `if:` is evaluated before matrix expansion. When it
// evaluates false, GitHub emits exactly one "skipped" entry // evaluates false, GitHub emits exactly one "skipped" entry
// without a "(shard)" suffix instead of N matrix entries. Two // instead of N matrix entries. Shapes include:
// shapes are possible:
// - inline matrix: `<prefix>` // - inline matrix: `<prefix>`
// - reusable workflow: `<prefix> / <called-job>` // - reusable workflow: `<prefix> / <called-job>`
// Both lack the ` (` shard marker. Detect that precise shape so // Reusable workflows can also retain an unevaluated matrix
// we don't poll forever — and so we don't mistake a partially // expression in the shard suffix. Recognize that placeholder,
// materialized dynamic/reusable matrix for a skipped one. // while still waiting for missing shards of an expanded matrix.
const unexpandedSkip = matchingJobs.length === 1 && const unexpandedSkip = matchingJobs.length === 1 &&
!matchingJobs[0].name.includes(' (') && (!matchingJobs[0].name.includes(' (') ||
/\(\$\{\{\s*matrix\.partition\s*\}\}\)$/.test(matchingJobs[0].name)) &&
matchingJobs[0].status === 'completed' && matchingJobs[0].status === 'completed' &&
matchingJobs[0].conclusion === 'skipped'; matchingJobs[0].conclusion === 'skipped';
if (unexpandedSkip) { if (unexpandedSkip) {
@@ -198,7 +198,7 @@ runs:
totalCount += missing; totalCount += missing;
completedCount += missing; completedCount += missing;
if (!cached) { if (!cached) {
console.log(`${spec.prefix}: job-level skip (bare entry, conclusion=skipped); treating as all ${spec.expected_count} skipped`); console.log(`${spec.prefix}: job-level skip (unexpanded entry, conclusion=skipped); treating as all ${spec.expected_count} skipped`);
} }
} else { } else {
console.log(`${spec.prefix}: found ${matchingJobs.length}/${spec.expected_count} jobs (waiting for more)`); console.log(`${spec.prefix}: found ${matchingJobs.length}/${spec.expected_count} jobs (waiting for more)`);