Skip to content

Commit 718a15f

Browse files
committed
fix(ci): route Markdown-only PR jobs away from Blacksmith runners
Add a lightweight ci_scope job on ubuntu-24.04 that detects docs-only changes before any Blacksmith-backed job is scheduled. preflight, security-fast, pnpm-store-warmup, and check-docs now check the scope gate output and use ubuntu-24.04 for Markdown-only PRs, avoiding unnecessary Blacksmith queue contention.
1 parent d97574a commit 718a15f

3 files changed

Lines changed: 82 additions & 10 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,47 @@ env:
4141
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
4242

4343
jobs:
44+
# Scope gate: detect docs-only changes early on a GitHub-hosted runner so
45+
# Markdown-only PRs avoid Blacksmith-backed CI queues.
46+
ci_scope:
47+
name: CI scope gate
48+
permissions:
49+
contents: read
50+
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
51+
runs-on: ubuntu-24.04
52+
timeout-minutes: 10
53+
outputs:
54+
docs_only: ${{ steps.scope.outputs.docs_only }}
55+
docs_changed: ${{ steps.scope.outputs.docs_changed }}
56+
steps:
57+
- name: Checkout
58+
if: github.event_name != 'workflow_dispatch'
59+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
60+
with:
61+
fetch-depth: 0
62+
63+
- name: Detect docs-only changes
64+
id: docs_scope
65+
if: github.event_name != 'workflow_dispatch'
66+
uses: ./.github/actions/detect-docs-changes
67+
68+
- name: Publish scope outputs
69+
id: scope
70+
env:
71+
DOCS_ONLY: ${{ github.event_name == 'workflow_dispatch' && 'false' || steps.docs_scope.outputs.docs_only || 'false' }}
72+
DOCS_CHANGED: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.docs_scope.outputs.docs_changed || 'false' }}
73+
run: |
74+
echo "docs_only=${DOCS_ONLY}" >> "$GITHUB_OUTPUT"
75+
echo "docs_changed=${DOCS_CHANGED}" >> "$GITHUB_OUTPUT"
76+
4477
# Preflight: establish routing truth and job matrices once, then let real
4578
# work fan out from a single source of truth.
4679
preflight:
4780
permissions:
4881
contents: read
82+
needs: [ci_scope]
4983
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
50-
runs-on: ${{ github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04') }}
84+
runs-on: ${{ github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.event_name == 'pull_request' && needs.ci_scope.outputs.docs_only == 'true' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04')) }}
5185
timeout-minutes: 20
5286
outputs:
5387
checkout_revision: ${{ steps.checkout_ref.outputs.sha }}
@@ -349,13 +383,14 @@ jobs:
349383
}
350384
EOF
351385
352-
# Run dependency-free security checks in parallel with scope detection so the
353-
# main Node jobs do not have to wait for Python/pre-commit setup.
386+
# Run dependency-free security checks after the lightweight scope gate so
387+
# Markdown-only PRs do not reserve Blacksmith while still keeping the check.
354388
security-fast:
355389
permissions:
356390
contents: read
391+
needs: [ci_scope]
357392
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
358-
runs-on: ${{ github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04') }}
393+
runs-on: ${{ github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.event_name == 'pull_request' && needs.ci_scope.outputs.docs_only == 'true' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04')) }}
359394
timeout-minutes: 20
360395
env:
361396
PRE_COMMIT_HOME: .cache/pre-commit-security-fast
@@ -497,7 +532,7 @@ jobs:
497532
contents: read
498533
needs: [preflight]
499534
if: needs.preflight.outputs.run_node == 'true' || needs.preflight.outputs.run_check_docs == 'true'
500-
runs-on: ${{ github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04') }}
535+
runs-on: ${{ github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.event_name == 'pull_request' && needs.preflight.outputs.docs_only == 'true' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04')) }}
501536
timeout-minutes: 20
502537
steps:
503538
- name: Checkout
@@ -1592,7 +1627,7 @@ jobs:
15921627
contents: read
15931628
needs: [preflight]
15941629
if: needs.preflight.outputs.run_check_docs == 'true'
1595-
runs-on: ${{ github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04') }}
1630+
runs-on: ${{ github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.event_name == 'pull_request' && needs.preflight.outputs.docs_only == 'true' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04')) }}
15961631
timeout-minutes: 20
15971632
steps:
15981633
- name: Checkout

‎docs/ci.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ OpenClaw CI runs on every push to `main` and every pull request. The `preflight`
1414

1515
| Job | Purpose | When it runs |
1616
| ---------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------- |
17+
| `ci_scope` | Detect Markdown/docs-only changes early on a GitHub-hosted runner so trivial PRs avoid Blacksmith queues | Always on non-draft pushes and PRs |
1718
| `preflight` | Detect docs-only changes, changed scopes, changed extensions, and build the CI manifest | Always on non-draft pushes and PRs |
1819
| `security-fast` | Private key detection, changed-workflow audit via `zizmor`, and production lockfile audit | Always on non-draft pushes and PRs |
1920
| `check-dependencies` | Production Knip dependency-only pass plus the unused-file allowlist guard | Node-relevant changes |
@@ -36,10 +37,11 @@ OpenClaw CI runs on every push to `main` and every pull request. The `preflight`
3637

3738
## Fail-fast order
3839

39-
1. `preflight` decides which lanes exist at all. The `docs-scope` and `changed-scope` logic are steps inside this job, not standalone jobs.
40-
2. `security-fast`, `check-*`, `check-additional-*`, `check-docs`, and `skills-python` fail quickly without waiting on the heavier artifact and platform matrix jobs.
41-
3. `build-artifacts` overlaps with the fast Linux lanes so downstream consumers can start as soon as the shared build is ready.
42-
4. Heavier platform and runtime lanes fan out after that: `checks-fast-core`, `checks-fast-contracts-plugins-*`, `checks-fast-contracts-channels-*`, `checks-node-core-*`, `checks-windows`, `macos-node`, `macos-swift`, and `android`.
40+
1. `ci_scope` runs first on a GitHub-hosted runner to detect Markdown/docs-only changes, letting trivial PRs skip Blacksmith-backed queues. The `docs-scope` logic is a step inside this job.
41+
2. `preflight` decides which lanes exist at all. The `changed-scope` logic is a step inside this job, not a standalone job.
42+
3. `security-fast`, `check-*`, `check-additional-*`, `check-docs`, and `skills-python` fail quickly without waiting on the heavier artifact and platform matrix jobs.
43+
4. `build-artifacts` overlaps with the fast Linux lanes so downstream consumers can start as soon as the shared build is ready.
44+
5. Heavier platform and runtime lanes fan out after that: `checks-fast-core`, `checks-fast-contracts-plugins-*`, `checks-fast-contracts-channels-*`, `checks-node-core-*`, `checks-windows`, `macos-node`, `macos-swift`, and `android`.
4345

4446
GitHub may mark superseded jobs as `cancelled` when a newer push lands on the same PR or `main` ref. Treat that as CI noise unless the newest run for the same ref is also failing. Matrix jobs use `fail-fast: false`, and `build-artifacts` reports embedded channel, core-support-boundary, and gateway-watch failures directly instead of queuing tiny verifier jobs. The automatic CI concurrency key is versioned (`CI-v7-*`) so a GitHub-side zombie in an old queue group cannot indefinitely block newer main runs. Manual full-suite runs use `CI-manual-v1-*` and do not cancel in-progress runs.
4547

‎test/scripts/ci-workflow-guards.test.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,4 +486,39 @@ describe("ci workflow guards", () => {
486486
expect(workflow).toContain("Network runtime boundary-sensitive added lines");
487487
expect(workflow).toContain("if: ${{ github.event_name != 'pull_request' }}");
488488
});
489+
490+
it("routes Markdown-only PR jobs away from Blacksmith runners", () => {
491+
const workflow = readCiWorkflow();
492+
493+
// ci_scope must exist and run on ubuntu-24.04
494+
const ciScope = workflow.jobs.ci_scope;
495+
expect(ciScope).toBeDefined();
496+
expect(ciScope["runs-on"]).toBe("ubuntu-24.04");
497+
expect(ciScope.outputs.docs_only).toBeDefined();
498+
expect(ciScope.outputs.docs_changed).toBeDefined();
499+
500+
// preflight must depend on ci_scope and conditionally use ubuntu-24.04
501+
const preflight = workflow.jobs.preflight;
502+
expect(preflight.needs).toContain("ci_scope");
503+
expect(preflight["runs-on"]).toContain("needs.ci_scope.outputs.docs_only == 'true'");
504+
expect(preflight["runs-on"]).toContain("ubuntu-24.04");
505+
expect(preflight["runs-on"]).toContain("blacksmith-4vcpu-ubuntu-2404");
506+
507+
// security-fast must depend on ci_scope and conditionally use ubuntu-24.04
508+
const securityFast = workflow.jobs["security-fast"];
509+
expect(securityFast.needs).toContain("ci_scope");
510+
expect(securityFast["runs-on"]).toContain("needs.ci_scope.outputs.docs_only == 'true'");
511+
expect(securityFast["runs-on"]).toContain("ubuntu-24.04");
512+
expect(securityFast["runs-on"]).toContain("blacksmith-4vcpu-ubuntu-2404");
513+
514+
// pnpm-store-warmup must conditionally use ubuntu-24.04 via preflight output
515+
const pnpmWarmup = workflow.jobs["pnpm-store-warmup"];
516+
expect(pnpmWarmup["runs-on"]).toContain("needs.preflight.outputs.docs_only == 'true'");
517+
expect(pnpmWarmup["runs-on"]).toContain("ubuntu-24.04");
518+
519+
// check-docs must conditionally use ubuntu-24.04 via preflight output
520+
const checkDocs = workflow.jobs["check-docs"];
521+
expect(checkDocs["runs-on"]).toContain("needs.preflight.outputs.docs_only == 'true'");
522+
expect(checkDocs["runs-on"]).toContain("ubuntu-24.04");
523+
});
489524
});

0 commit comments

Comments
 (0)