feat: exclude .gitea/ directory from Git Diff analysis and update TODO
This commit is contained in:
+8
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user