fix: write findings to review dir
This commit is contained in:
+12
-6
@@ -16,13 +16,19 @@ function buildTable(findings) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 寫入 findings.json 到 workspace
|
||||
* 寫入 findings.json。
|
||||
* 預設寫到 workspace;若提供 mirrorDir,則同步寫入另一份供 repo commit 使用。
|
||||
*/
|
||||
export function saveFindings(workspace, findings) {
|
||||
const fullPath = path.join(workspace, FINDINGS_PATH);
|
||||
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
||||
fs.writeFileSync(fullPath, JSON.stringify(findings, null, 2) + '\n', 'utf8');
|
||||
console.log(` ✅ findings 寫入: ${fullPath} (${findings.length} 筆)`);
|
||||
export function saveFindings(workspace, findings, mirrorDir = null) {
|
||||
const targets = [workspace];
|
||||
if (mirrorDir && mirrorDir !== workspace) targets.push(mirrorDir);
|
||||
|
||||
for (const targetDir of targets) {
|
||||
const fullPath = path.join(targetDir, FINDINGS_PATH);
|
||||
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
||||
fs.writeFileSync(fullPath, JSON.stringify(findings, null, 2) + '\n', 'utf8');
|
||||
console.log(` ✅ findings 寫入: ${fullPath} (${findings.length} 筆)`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user