feat: exclude .gitea/ directory from Git Diff analysis and update TODO
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
4. 盡量將應用程式放在 ./app,修改 entrypoint.sh 與 Dockerfile 讓程式可以正常運行
|
||||
5. 將提示詞放到 ./app/prompts 內供程式讀取
|
||||
6. API Key 支援逗號分隔傳入多個,隨機順序各嘗試一次,全部失敗則 exit 1
|
||||
7. 讀取 Git Diff 時排除 `.gitea/` 資料夾內的所有檔案,避免 AI 分析 workflow 設定等非業務程式碼
|
||||
|
||||
# 使用說明
|
||||
|
||||
|
||||
@@ -40,6 +40,11 @@
|
||||
- 驗收:log 中能看到「key[N/M] 失敗」等訊息,換 key 後繼續執行;傳入單一 Key 時行為與原本相同;全部 Key 失敗時 log「所有 API Key 均失敗,終止流程」且 workflow 狀態為失敗。
|
||||
- 完成
|
||||
|
||||
## 階段九:Git Diff 排除 .gitea/ 資料夾
|
||||
- 目標:讀取 Git Diff 時排除 `.gitea/` 資料夾內的所有檔案,避免 AI 分析 workflow 設定等非業務程式碼。
|
||||
- 驗收:PR 中有 `.gitea/` 路徑的變更時,diff 內容不包含該路徑的區塊,AI 分析結果不含 `.gitea/` 相關問題。
|
||||
- 完成
|
||||
|
||||
---
|
||||
|
||||
所有階段驗收通過。
|
||||
|
||||
+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