Skip to content

Commit e427e5b

Browse files
committed
fix(ci): honor trusted dispatch matrix runners
1 parent eb1c111 commit e427e5b

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2590,7 +2590,7 @@ jobs:
25902590
name: ${{ matrix.check_name }}
25912591
needs: [preflight]
25922592
if: ${{ !cancelled() && always() && needs.preflight.outputs.run_check == 'true' }}
2593-
runs-on: ${{ vars.OPENCLAW_CI_RUNNER_BACKEND == 'github' && 'ubuntu-24.04' || (vars.OPENCLAW_CI_RUNNER_BACKEND == 'hybrid' && (github.run_attempt > 1 || (matrix.task != 'lint' && matrix.task != 'test-types' && matrix.task != 'dependencies'))) && 'ubuntu-24.04' || github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || contains(fromJSON('["OWNER","MEMBER","COLLABORATOR","CONTRIBUTOR"]'), github.event.pull_request.author_association)) && (matrix.runner || 'blacksmith-4vcpu-ubuntu-2404') || 'ubuntu-24.04') }}
2593+
runs-on: ${{ vars.OPENCLAW_CI_RUNNER_BACKEND == 'github' && 'ubuntu-24.04' || (vars.OPENCLAW_CI_RUNNER_BACKEND == 'hybrid' && (github.event_name == 'workflow_dispatch' || github.run_attempt > 1 || (matrix.task != 'lint' && matrix.task != 'test-types' && matrix.task != 'dependencies'))) && 'ubuntu-24.04' || (github.event_name == 'workflow_dispatch' && inputs.release_gate) && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || contains(fromJSON('["OWNER","MEMBER","COLLABORATOR","CONTRIBUTOR"]'), github.event.pull_request.author_association)) && (matrix.runner || 'blacksmith-4vcpu-ubuntu-2404') || 'ubuntu-24.04') }}
25942594
timeout-minutes: 20
25952595
strategy:
25962596
fail-fast: false

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function evaluateWorkflowExpression(
107107
headRepository?: string;
108108
hostedRunnerProfileContract?: boolean;
109109
matrix?: Record<string, unknown>;
110+
releaseGate?: boolean;
110111
repository: string;
111112
runCheck?: boolean;
112113
runnerBackend?: "" | "blacksmith" | "github" | "hybrid";
@@ -146,6 +147,9 @@ function evaluateWorkflowExpression(
146147
}
147148
: {},
148149
},
150+
inputs: {
151+
release_gate: context.releaseGate ?? false,
152+
},
149153
matrix: context.matrix ?? {},
150154
needs: {
151155
preflight: {
@@ -3629,6 +3633,42 @@ NODE
36293633
).toBe(96);
36303634
});
36313635

3636+
it("honors trusted dispatch runner selection for check shards", () => {
3637+
const runsOn = readCiWorkflow().jobs["check-shard"]["runs-on"];
3638+
const lintMatrix = {
3639+
runner: "blacksmith-32vcpu-ubuntu-2404",
3640+
task: "lint",
3641+
};
3642+
const evaluateDispatch = (
3643+
runnerBackend: "blacksmith" | "github" | "hybrid",
3644+
releaseGate = false,
3645+
) =>
3646+
evaluateWorkflowExpression(runsOn, {
3647+
eventName: "workflow_dispatch",
3648+
matrix: lintMatrix,
3649+
releaseGate,
3650+
repository: "openclaw/openclaw",
3651+
runAttempt: 1,
3652+
runnerBackend,
3653+
});
3654+
3655+
expect(evaluateDispatch("blacksmith")).toBe("blacksmith-32vcpu-ubuntu-2404");
3656+
expect(evaluateDispatch("blacksmith", true)).toBe("ubuntu-24.04");
3657+
expect(evaluateDispatch("github")).toBe("ubuntu-24.04");
3658+
expect(evaluateDispatch("hybrid")).toBe("ubuntu-24.04");
3659+
expect(
3660+
evaluateWorkflowExpression(runsOn, {
3661+
authorAssociation: "NONE",
3662+
eventName: "pull_request",
3663+
headRepository: "openclaw/openclaw",
3664+
matrix: lintMatrix,
3665+
repository: "openclaw/openclaw",
3666+
runAttempt: 1,
3667+
runnerBackend: "blacksmith",
3668+
}),
3669+
).toBe("ubuntu-24.04");
3670+
});
3671+
36323672
it("encodes GitHub, Blacksmith, and hybrid runner-backend shapes", () => {
36333673
const workflow = readCiWorkflow();
36343674
const jobs = workflow.jobs as Record<string, { "runs-on": unknown }>;

0 commit comments

Comments
 (0)