fix: unblock unattended research workflows
This commit is contained in:
@@ -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);");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user