feat: exclude .gitea/ directory from Git Diff analysis and update TODO

This commit is contained in:
2026-05-13 00:41:12 +00:00
parent fe7381c36e
commit de8de251ba
3 changed files with 14 additions and 1 deletions
+8 -1
View File
@@ -8,7 +8,14 @@ const api = (path) => `${GITEA_SERVER_URL.replace(/\/$/, '')}/api/v1${path}`;
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/']);
}
function filterDiff(diff, excludePrefixes) {
const blocks = diff.split(/(?=^diff --git )/m);
return blocks
.filter(block => !excludePrefixes.some(prefix => block.match(new RegExp(`^diff --git a/${prefix.replace(/\//g, '\\/')}`))))
.join('');
}
export async function postComment(body) {