debug: commitFile 加上詳細 log

This commit is contained in:
2026-05-11 10:09:16 +00:00
parent da43cb02b0
commit 5f77b83a0f
+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,