mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-28 12:36:55 +02:00
refactor: deduplicate changed lane detection
This commit is contained in:
@@ -203,6 +203,21 @@ export function detectChangedLanes(changedPaths, options = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{ paths: string[]; base: string; head?: string; staged?: boolean }} params
|
||||
* @returns {ChangedLaneResult}
|
||||
*/
|
||||
export function detectChangedLanesForPaths(params) {
|
||||
const packageJsonChangeKind = params.paths.includes("package.json")
|
||||
? classifyPackageJsonChangeFromGit({
|
||||
base: params.base,
|
||||
head: params.head,
|
||||
staged: params.staged,
|
||||
})
|
||||
: null;
|
||||
return detectChangedLanes(params.paths, { packageJsonChangeKind });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{ base: string; head?: string; includeWorktree?: boolean; cwd?: string }} params
|
||||
* @returns {string[]}
|
||||
@@ -458,14 +473,12 @@ if (isDirectRun()) {
|
||||
: args.staged
|
||||
? listStagedChangedPaths()
|
||||
: listChangedPathsFromGit({ base: args.base, head: args.head });
|
||||
const packageJsonChangeKind = paths.includes("package.json")
|
||||
? classifyPackageJsonChangeFromGit({
|
||||
base: args.base,
|
||||
head: args.head,
|
||||
staged: args.staged,
|
||||
})
|
||||
: null;
|
||||
const result = detectChangedLanes(paths, { packageJsonChangeKind });
|
||||
const result = detectChangedLanesForPaths({
|
||||
paths,
|
||||
base: args.base,
|
||||
head: args.head,
|
||||
staged: args.staged,
|
||||
});
|
||||
if (args.githubOutput) {
|
||||
writeChangedLaneGitHubOutput(result);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { performance } from "node:perf_hooks";
|
||||
import {
|
||||
classifyPackageJsonChangeFromGit,
|
||||
detectChangedLanes,
|
||||
detectChangedLanesForPaths,
|
||||
listChangedPathsFromGit,
|
||||
listStagedChangedPaths,
|
||||
normalizeChangedPath,
|
||||
@@ -285,14 +284,12 @@ if (isDirectRun()) {
|
||||
: args.staged
|
||||
? listStagedChangedPaths()
|
||||
: listChangedPathsFromGit({ base: args.base, head: args.head });
|
||||
const packageJsonChangeKind = paths.includes("package.json")
|
||||
? classifyPackageJsonChangeFromGit({
|
||||
base: args.base,
|
||||
head: args.head,
|
||||
staged: args.staged,
|
||||
})
|
||||
: null;
|
||||
const result = detectChangedLanes(paths, { packageJsonChangeKind });
|
||||
const result = detectChangedLanesForPaths({
|
||||
paths,
|
||||
base: args.base,
|
||||
head: args.head,
|
||||
staged: args.staged,
|
||||
});
|
||||
process.exitCode = await runChangedCheck(result, {
|
||||
...args,
|
||||
explicitPaths: args.paths.length > 0,
|
||||
|
||||
@@ -734,9 +734,6 @@ export function resolveChangedTestTargetPlan(changedPaths, options = {}) {
|
||||
targets.push(changedPath);
|
||||
}
|
||||
}
|
||||
if (useBroadFallback && changedLanes.lanes.all) {
|
||||
return { mode: "broad", targets: [] };
|
||||
}
|
||||
if (useBroadFallback && changedLanes.extensionImpactFromCore) {
|
||||
targets.push("extensions");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user