fix: unblock unattended research workflows

This commit is contained in:
Advait Paliwal
2026-04-12 13:15:45 -07:00
parent aa96b5ee14
commit 4f6574f233
13 changed files with 117 additions and 12 deletions

View File

@@ -16,14 +16,28 @@ const PATCHED_CONFIG_EXPR =
export function patchPiWebAccessSource(relativePath, source) {
let patched = source;
let changed = false;
if (patched.includes(PATCHED_CONFIG_EXPR)) {
return patched;
if (!patched.includes(PATCHED_CONFIG_EXPR)) {
patched = patched.split(LEGACY_CONFIG_EXPR).join(PATCHED_CONFIG_EXPR);
changed = patched !== source;
}
patched = patched.split(LEGACY_CONFIG_EXPR).join(PATCHED_CONFIG_EXPR);
if (relativePath === "index.ts") {
if (patched.includes('return "summary-review";')) {
patched = patched.replace('return "summary-review";', 'return "none";');
changed = true;
}
if (patched.includes('summary-review = open curator with auto summary draft (default)')) {
patched = patched.replace(
'summary-review = open curator with auto summary draft (default)',
'summary-review = open curator with auto summary draft',
);
changed = true;
}
}
if (relativePath === "index.ts" && patched !== source) {
if (relativePath === "index.ts" && changed) {
patched = patched.replace('import { join } from "node:path";', 'import { dirname, join } from "node:path";');
patched = patched.replace('const dir = join(homedir(), ".pi");', "const dir = dirname(WEB_SEARCH_CONFIG_PATH);");
}