refactor: update TODO stages to reflect current status and improve clarity; modify diff filtering logic in gitea.js and main.js
This commit is contained in:
+2
-2
@@ -8,14 +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 filterDiff(resp.data, ['.gitea/']);
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 過濾 diff 內容,移除路徑符合 excludePrefixes 的區塊。
|
||||
* 每個區塊以 "diff --git a/<prefix>" 開頭判斷,使用 startsWith 精確比對前綴。
|
||||
*/
|
||||
function filterDiff(diff, excludePrefixes) {
|
||||
export function filterDiff(diff, excludePrefixes) {
|
||||
return diff.split(/(?=^diff --git )/m)
|
||||
.filter(block => !excludePrefixes.some(p => block.startsWith(`diff --git a/${p}`)))
|
||||
.join('');
|
||||
|
||||
Reference in New Issue
Block a user