diff --git a/app/gitea.js b/app/gitea.js index e30b1b1..cbd59d4 100644 --- a/app/gitea.js +++ b/app/gitea.js @@ -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,