refactor: update commitAndPush function to accept repoDir parameter and adjust related tests

This commit is contained in:
2026-05-13 01:46:27 +00:00
parent c758c99a28
commit cc6345c32e
4 changed files with 26 additions and 40 deletions
+2 -3
View File
@@ -7,12 +7,11 @@ const headers = () => ({ Authorization: `token ${GITEA_TOKEN}`, 'Content-Type':
const api = (path) => `${GITEA_SERVER_URL.replace(/\/$/, '')}/api/v1${path}`;
/**
* 取得 PR 的原始 Git Diff 內容。
* 注意:回傳值未經路徑過濾,呼叫端須使用 filterDiff 排除敏感路徑(如 .gitea/)後再傳給 AI。
* 取得 PR 的 Git Diff 內容,已自動排除 .gitea/ 資料夾
*/
export async function getPRDiff() {
const resp = await axios.get(api(`/repos/${GITEA_REPOSITORY}/pulls/${PR_NUMBER}.diff`), { headers: headers(), timeout: 60000, httpsAgent });
return resp.data;
return filterDiff(resp.data, ['.gitea/']);
}
/**