Merge pull request 'feat/refactor/kiro/1' (#57) from feat/refactor/kiro/1 into feat/refactor/main

Reviewed-on: jiantw83/code-review#57
This commit is contained in:
2026-05-11 10:10:23 +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,