Skip to content

Commit 236160e

Browse files
justin808claude
andcommitted
Fix docs-only CI check to allow running workflows
The safety check was blocking docs-only commits whenever the previous master commit had ANY running workflows, even if they hadn't failed yet. This created a bottleneck when workflows were slow (e.g., integration tests). Changes: - Allow docs-only skips when previous workflows are running (not failed yet) - Only block if completed workflows have actually failed - Add informative logging about running vs failed workflows Rationale: - Running workflows haven't failed yet → no known issue to block on - They will complete and validate the previous commit independently - Eliminates bottleneck from slow-running workflows - Still maintains safety by blocking on actual failures Fixes the circular dependency issue where docs-only commits couldn't merge because previous commit's workflows were still in progress. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 9383537 commit 236160e

File tree

1 file changed

+23
-11
lines changed
  • .github/actions/ensure-master-docs-safety

1 file changed

+23
-11
lines changed

.github/actions/ensure-master-docs-safety/action.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ runs:
8383
}
8484
8585
// Check for workflows that are still running
86-
// We require all workflows to complete before allowing docs-only skip
87-
// This prevents skipping CI when the previous commit hasn't been fully validated
86+
// We allow docs-only skips even if workflows are still running, as long as none have failed yet.
87+
// Rationale:
88+
// - Running workflows haven't failed yet, so there's no known issue to block on
89+
// - They will complete and validate the previous commit independently
90+
// - Requiring completion creates bottlenecks when workflows are slow (e.g., integration tests)
91+
// - If a workflow later fails, it will be caught on the next non-docs commit
8892
const incompleteRuns = Array.from(latestByWorkflow.values()).filter(
8993
(run) => run.status !== 'completed'
9094
);
@@ -93,23 +97,27 @@ runs:
9397
const details = incompleteRuns
9498
.map((run) => `- [${run.name} #${run.run_number}](${run.html_url}) is still ${run.status}`)
9599
.join('\n');
96-
core.setFailed(
100+
core.info(
97101
[
98-
`Cannot skip CI for docs-only commit because previous master commit ${previousSha} still has running workflows:`,
102+
`Previous master commit ${previousSha} still has running workflows:`,
99103
details,
100104
'',
101-
'Wait for these workflows to complete before pushing docs-only changes.'
105+
'Allowing docs-only skip because running workflows have not failed yet.'
102106
].join('\n')
103107
);
104-
return;
108+
// Continue to check completed workflows for failures, don't return early
105109
}
106110
107-
// For each workflow run, fetch the jobs to check the latest attempt's conclusion.
111+
// For each COMPLETED workflow run, fetch the jobs to check the latest attempt's conclusion.
108112
// GitHub's run.conclusion reflects the overall run, but if a run was re-run and succeeded,
109113
// we want to consider that success, not the original failure.
114+
// We only check completed runs - incomplete runs are allowed (they haven't failed yet).
110115
const failingRuns = [];
116+
const completedRuns = Array.from(latestByWorkflow.values()).filter(
117+
(run) => run.status === 'completed'
118+
);
111119
112-
for (const run of Array.from(latestByWorkflow.values())) {
120+
for (const run of completedRuns) {
113121
// Fetch jobs for this run to check the latest attempt
114122
const jobsResponse = await github.rest.actions.listJobsForWorkflowRun({
115123
owner: context.repo.owner,
@@ -121,8 +129,8 @@ runs:
121129
const jobs = jobsResponse.data.jobs;
122130
123131
if (jobs.length === 0) {
124-
// No jobs found - treat as incomplete
125-
failingRuns.push(run);
132+
// No jobs found - skip this run (don't treat as failing)
133+
core.warning(`No jobs found for workflow run ${run.id} (${run.name}). Skipping.`);
126134
continue;
127135
}
128136
@@ -150,7 +158,11 @@ runs:
150158
}
151159
152160
if (failingRuns.length === 0) {
153-
core.info(`Previous master commit ${previousSha} completed without failures. Docs-only skip allowed.`);
161+
if (incompleteRuns.length > 0) {
162+
core.info(`Previous master commit ${previousSha} has ${incompleteRuns.length} running workflow(s) but no completed failures. Docs-only skip allowed.`);
163+
} else {
164+
core.info(`Previous master commit ${previousSha} completed without failures. Docs-only skip allowed.`);
165+
}
154166
return;
155167
}
156168

0 commit comments

Comments
 (0)