debug: commitFile 加上詳細 log
This commit is contained in:
+4
-1
@@ -28,7 +28,9 @@ export async function commitFile(filePath, content, message) {
|
|||||||
try {
|
try {
|
||||||
const existing = await axios.get(`${url}?ref=${PR_HEAD_BRANCH}`, { headers: headers(), httpsAgent, timeout: 15000 });
|
const existing = await axios.get(`${url}?ref=${PR_HEAD_BRANCH}`, { headers: headers(), httpsAgent, timeout: 15000 });
|
||||||
sha = existing.data.sha;
|
sha = existing.data.sha;
|
||||||
} catch {
|
console.log(` [debug] 取得現有檔案 SHA=${sha}`);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(` [debug] 檔案不存在,將建立新檔案: ${e.response?.status || e.message}`);
|
||||||
sha = undefined;
|
sha = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +41,7 @@ export async function commitFile(filePath, content, message) {
|
|||||||
...(sha ? { sha } : {}),
|
...(sha ? { sha } : {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(` [debug] ${sha ? 'PUT' : 'POST'} ${url} branch=${PR_HEAD_BRANCH}`);
|
||||||
const resp = await axios.request({
|
const resp = await axios.request({
|
||||||
method: sha ? 'put' : 'post',
|
method: sha ? 'put' : 'post',
|
||||||
url,
|
url,
|
||||||
|
|||||||
Reference in New Issue
Block a user