Compare commits

...

6 Commits

Author SHA1 Message Date
jiantw83 5f77b83a0f debug: commitFile 加上詳細 log 2026-05-11 10:09:16 +00:00
jiantw83 da43cb02b0 chore: update ai-review findings [skip ci] 2026-05-11 10:08:57 +00:00
AI Review Bot 577a930438 chore: update ai-review findings [skip ci] 2026-05-11 10:08:26 +00:00
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
3 changed files with 6 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
[]
+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,
+4 -1
View File
@@ -28,7 +28,9 @@ export async function commitFile(filePath, content, message) {
try {
const existing = await axios.get(`${url}?ref=${PR_HEAD_BRANCH}`, { headers: headers(), httpsAgent, timeout: 15000 });
sha = existing.data.sha;
} catch {
console.log(` [debug] 取得現有檔案 SHA=${sha}`);
} catch (e) {
console.log(` [debug] 檔案不存在,將建立新檔案: ${e.response?.status || e.message}`);
sha = undefined;
}
@@ -39,6 +41,7 @@ export async function commitFile(filePath, content, message) {
...(sha ? { sha } : {}),
};
console.log(` [debug] ${sha ? 'PUT' : 'POST'} ${url} branch=${PR_HEAD_BRANCH}`);
const resp = await axios.request({
method: sha ? 'put' : 'post',
url,