Compare commits

...

5 Commits

Author SHA1 Message Date
jiantw83 121f66b0b3 debug: git.js 加上參數 log 2026-05-11 10:06:28 +00:00
jiantw83 faa808bb5f test update 2026-05-11 10:06:05 +00:00
jiantw83 07df3ef4a5 test 2026-05-11 10:05:57 +00:00
jiantw83 fc537958ca debug: commit/push 失敗時顯示詳細錯誤 2026-05-11 10:01:40 +00:00
jiantw83 1c321b7ba2 fix: commitAndPush 加上 await 2026-05-11 10:00:08 +00:00
3 changed files with 5 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
[]
+3 -1
View File
@@ -10,6 +10,7 @@ export async function commitAndPush(workspace) {
try {
const fullPath = path.join(workspace, FINDINGS_PATH);
const content = fs.readFileSync(fullPath, 'utf8');
console.log(` [debug] FINDINGS_PATH=${FINDINGS_PATH} branch=${process.env.PR_HEAD_BRANCH} token=${process.env.GITEA_TOKEN ? '***' : 'EMPTY'}`);
const result = await commitFile(
FINDINGS_PATH,
content,
@@ -18,6 +19,7 @@ export async function commitAndPush(workspace) {
const commitHash = result.commit?.sha?.slice(0, 7) || 'unknown';
console.log(` ✅ persisted findings commit=${commitHash} push=${process.env.PR_HEAD_BRANCH}`);
} catch (e) {
console.log(` ⚠️ Runner failed: commit/push 失敗: ${e.message}`);
const detail = e.response?.data ? JSON.stringify(e.response.data) : e.message;
console.log(` ⚠️ Runner failed: commit/push 失敗: ${e.response?.status || ''} ${detail}`);
}
}
+1 -1
View File
@@ -91,7 +91,7 @@ async function main() {
// Step5: commit/push findings.json 到來源分支
console.log('\n💾 Step5: 記憶區 Commit/Push');
commitAndPush(WORKSPACE);
await commitAndPush(WORKSPACE);
// Step6: 有 critical 問題則 exit 1
console.log('\n🚦 Step6: 嚴重問題檢查');