

























@@ -1,4 +1,6 @@
11import { performance } from "node:perf_hooks";
2+import { accessSync, constants } from "node:fs";
3+import path from "node:path";
24import {
35detectChangedLanesForPaths,
46listChangedPathsFromGit,
@@ -41,6 +43,38 @@ function isTruthyEnvFlag(value) {
4143return normalized !== "" && normalized !== "0" && normalized !== "false" && normalized !== "no";
4244}
434546+function executableExistsOnPath(command, env = process.env) {
47+const pathValue = env.PATH ?? env.Path ?? "";
48+const pathExts =
49+process.platform === "win32" ? (env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";") : [""];
50+for (const searchPath of pathValue.split(path.delimiter)) {
51+if (!searchPath) {
52+continue;
53+}
54+for (const ext of pathExts) {
55+try {
56+accessSync(path.join(searchPath, `${command}${ext}`), constants.X_OK);
57+return true;
58+} catch {
59+continue;
60+}
61+}
62+}
63+return false;
64+}
65+66+export function shouldSkipAppLintForMissingSwiftlint(options = {}) {
67+const env = options.env ?? process.env;
68+const platform = options.platform ?? process.platform;
69+const swiftlintAvailable =
70+options.swiftlintAvailable ?? executableExistsOnPath("swiftlint", env);
71+return (
72+isTruthyEnvFlag(env.OPENCLAW_TESTBOX_REMOTE_RUN) &&
73+platform !== "darwin" &&
74+!swiftlintAvailable
75+);
76+}
77+4478export function shouldDelegateChangedCheckToCrabbox(argv = [], env = process.env) {
4579if (!isTruthyEnvFlag(env.OPENCLAW_TESTBOX)) {
4680return false;
@@ -198,7 +232,17 @@ export function createChangedCheckPlan(result, options = {}) {
198232if (lanes.tooling || lanes.liveDockerTooling) {
199233addLint("lint scripts", ["lint:scripts"]);
200234}
201-if (lanes.apps) {
235+if (lanes.apps && shouldSkipAppLintForMissingSwiftlint({ ...options, env: baseEnv })) {
236+addCommand(
237+"lint apps (swiftlint unavailable in Testbox)",
238+"node",
239+[
240+"-e",
241+"console.error('[check:changed] Swift app lint skipped: swiftlint is unavailable in this Linux Testbox; macOS CI owns SwiftLint coverage.')",
242+],
243+baseEnv,
244+);
245+} else if (lanes.apps) {
202246addLint("lint apps", ["lint:apps"]);
203247}
204248此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。