|
41 | 41 | FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" |
42 | 42 |
|
43 | 43 | jobs: |
| 44 | + # Scope gate: compute docs-only routing on a GitHub-hosted runner before any |
| 45 | + # canonical PR job chooses a Blacksmith runner label. |
| 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 | + env: |
| 60 | + CHECKOUT_REPO: ${{ github.repository }} |
| 61 | + CHECKOUT_REF: ${{ github.sha }} |
| 62 | + run: | |
| 63 | + set -euo pipefail |
| 64 | + git init "$GITHUB_WORKSPACE" |
| 65 | + git -C "$GITHUB_WORKSPACE" config gc.auto 0 |
| 66 | + git -C "$GITHUB_WORKSPACE" remote add origin "https://github.com/${CHECKOUT_REPO}.git" |
| 67 | + fetch_checkout_ref() { |
| 68 | + local ref="$1" |
| 69 | + local fetch_status |
| 70 | + for attempt in 1 2 3; do |
| 71 | + timeout --signal=TERM --kill-after=10s 120s git -C "$GITHUB_WORKSPACE" \ |
| 72 | + -c protocol.version=2 \ |
| 73 | + fetch --no-tags --prune --no-recurse-submodules --depth=2 origin \ |
| 74 | + "+${ref}:refs/remotes/origin/checkout" && return 0 |
| 75 | + fetch_status="$?" |
| 76 | + if [ "$fetch_status" != "124" ] && [ "$fetch_status" != "137" ]; then |
| 77 | + return "$fetch_status" |
| 78 | + fi |
| 79 | + if [ "$attempt" = "3" ]; then |
| 80 | + return "$fetch_status" |
| 81 | + fi |
| 82 | + echo "::warning::checkout fetch for '$ref' timed out on attempt $attempt; retrying" |
| 83 | + sleep 5 |
| 84 | + done |
| 85 | + } |
| 86 | + if fetch_checkout_ref "$CHECKOUT_REF"; then |
| 87 | + : |
| 88 | + else |
| 89 | + fetch_status="$?" |
| 90 | + if [ "$fetch_status" = "124" ] || [ "$fetch_status" = "137" ]; then |
| 91 | + echo "::error::checkout fetch for '$CHECKOUT_REF' timed out" |
| 92 | + fi |
| 93 | + exit "$fetch_status" |
| 94 | + fi |
| 95 | + git -C "$GITHUB_WORKSPACE" checkout --detach refs/remotes/origin/checkout |
| 96 | +
|
| 97 | + - name: Ensure scope base commit |
| 98 | + if: github.event_name != 'workflow_dispatch' |
| 99 | + uses: ./.github/actions/ensure-base-commit |
| 100 | + with: |
| 101 | + base-sha: ${{ github.event_name == 'push' && github.event.before || github.event.pull_request.base.sha }} |
| 102 | + fetch-ref: ${{ github.event_name == 'push' && github.ref_name || github.event.pull_request.base.ref }} |
| 103 | + |
| 104 | + - name: Detect docs-only changes |
| 105 | + id: docs_scope |
| 106 | + if: github.event_name != 'workflow_dispatch' |
| 107 | + uses: ./.github/actions/detect-docs-changes |
| 108 | + |
| 109 | + - name: Publish scope outputs |
| 110 | + id: scope |
| 111 | + env: |
| 112 | + DOCS_ONLY: ${{ github.event_name == 'workflow_dispatch' && 'false' || steps.docs_scope.outputs.docs_only || 'false' }} |
| 113 | + DOCS_CHANGED: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.docs_scope.outputs.docs_changed || 'false' }} |
| 114 | + run: | |
| 115 | + echo "docs_only=${DOCS_ONLY}" >> "$GITHUB_OUTPUT" |
| 116 | + echo "docs_changed=${DOCS_CHANGED}" >> "$GITHUB_OUTPUT" |
| 117 | +
|
44 | 118 | # Preflight: establish routing truth and job matrices once, then let real |
45 | 119 | # work fan out from a single source of truth. |
46 | 120 | preflight: |
47 | 121 | permissions: |
48 | 122 | contents: read |
| 123 | + needs: [ci_scope] |
49 | 124 | 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') }} |
| 125 | + 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')) }} |
51 | 126 | timeout-minutes: 20 |
52 | 127 | outputs: |
53 | 128 | checkout_revision: ${{ steps.checkout_ref.outputs.sha }} |
@@ -349,13 +424,14 @@ jobs: |
349 | 424 | } |
350 | 425 | EOF |
351 | 426 |
|
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. |
| 427 | + # Run dependency-free security checks after the lightweight scope gate so |
| 428 | + # Markdown-only PRs do not reserve Blacksmith while still keeping the check. |
354 | 429 | security-fast: |
355 | 430 | permissions: |
356 | 431 | contents: read |
| 432 | + needs: [ci_scope] |
357 | 433 | 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') }} |
| 434 | + 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')) }} |
359 | 435 | timeout-minutes: 20 |
360 | 436 | env: |
361 | 437 | PRE_COMMIT_HOME: .cache/pre-commit-security-fast |
@@ -497,7 +573,7 @@ jobs: |
497 | 573 | contents: read |
498 | 574 | needs: [preflight] |
499 | 575 | 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') }} |
| 576 | + 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')) }} |
501 | 577 | timeout-minutes: 20 |
502 | 578 | steps: |
503 | 579 | - name: Checkout |
@@ -1592,7 +1668,7 @@ jobs: |
1592 | 1668 | contents: read |
1593 | 1669 | needs: [preflight] |
1594 | 1670 | 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') }} |
| 1671 | + 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')) }} |
1596 | 1672 | timeout-minutes: 20 |
1597 | 1673 | steps: |
1598 | 1674 | - name: Checkout |
|
0 commit comments