mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
ci: prepare extension lint artifacts
This commit is contained in:
@@ -49,6 +49,17 @@ type ReactionTargetRef = {
|
||||
roomId: string;
|
||||
eventId: string;
|
||||
};
|
||||
type MatrixRawApprovalTarget = {
|
||||
to: string;
|
||||
threadId?: string | number | null;
|
||||
};
|
||||
type MatrixPrepareTargetParams = {
|
||||
cfg: CoreConfig;
|
||||
accountId?: string | null;
|
||||
gatewayUrl?: string;
|
||||
context?: unknown;
|
||||
rawTarget: MatrixRawApprovalTarget;
|
||||
};
|
||||
|
||||
export type MatrixApprovalHandlerDeps = {
|
||||
nowMs?: () => number;
|
||||
@@ -95,12 +106,7 @@ function normalizeThreadId(value?: string | number | null): string | undefined {
|
||||
}
|
||||
|
||||
async function prepareTarget(
|
||||
params: ChannelApprovalCapabilityHandlerContext & {
|
||||
rawTarget: {
|
||||
to: string;
|
||||
threadId?: string | number | null;
|
||||
};
|
||||
},
|
||||
params: MatrixPrepareTargetParams,
|
||||
): Promise<PreparedMatrixTarget | null> {
|
||||
const resolved = resolveHandlerContext(params);
|
||||
if (!resolved) {
|
||||
@@ -113,7 +119,7 @@ async function prepareTarget(
|
||||
const threadId = normalizeThreadId(params.rawTarget.threadId);
|
||||
if (target.kind === "user") {
|
||||
const account = resolveMatrixAccount({
|
||||
cfg: params.cfg as CoreConfig,
|
||||
cfg: params.cfg,
|
||||
accountId: resolved.accountId,
|
||||
});
|
||||
const repairDirectRooms = resolved.context.deps?.repairDirectRooms ?? repairMatrixDirectRooms;
|
||||
|
||||
@@ -20,6 +20,8 @@ export function runExtensionOxlint(params) {
|
||||
const tempConfigPath = path.join(tempDir, "oxlint.json");
|
||||
|
||||
try {
|
||||
prepareExtensionPackageBoundaryArtifacts(repoRoot);
|
||||
|
||||
const extensionFiles = params.roots.flatMap((root) =>
|
||||
collectTypeScriptFiles(path.resolve(repoRoot, root)),
|
||||
);
|
||||
@@ -50,6 +52,37 @@ export function runExtensionOxlint(params) {
|
||||
}
|
||||
}
|
||||
|
||||
function prepareExtensionPackageBoundaryArtifacts(repoRoot) {
|
||||
const releaseLock = acquireLocalHeavyCheckLockSync({
|
||||
cwd: repoRoot,
|
||||
env: process.env,
|
||||
toolName: "extension-package-boundary-artifacts",
|
||||
lockName: "extension-package-boundary-artifacts",
|
||||
});
|
||||
|
||||
try {
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[path.resolve(repoRoot, "scripts", "prepare-extension-package-boundary-artifacts.mjs")],
|
||||
{
|
||||
cwd: repoRoot,
|
||||
stdio: "inherit",
|
||||
env: process.env,
|
||||
},
|
||||
);
|
||||
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
if ((result.status ?? 1) !== 0) {
|
||||
process.exit(result.status ?? 1);
|
||||
}
|
||||
} finally {
|
||||
releaseLock();
|
||||
}
|
||||
}
|
||||
|
||||
function writeTempOxlintConfig(repoRoot, configPath) {
|
||||
const config = JSON.parse(fs.readFileSync(path.resolve(repoRoot, ".oxlintrc.json"), "utf8"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user