fix(drift): dedupe blocked auto-adopt escalations
This commit is contained in:
@@ -277,6 +277,12 @@ class DriftAdoptService:
|
||||
|
||||
# Step 3: 找出受影響的 YAML 檔並 commit 更新
|
||||
committed_files = await self._commit_drift_yaml(client, headers, branch_name, report)
|
||||
if not committed_files:
|
||||
return {
|
||||
"success": False,
|
||||
"message": "無直接匹配的 YAML 檔,未建立零 diff 承認 PR",
|
||||
"pr_url": None,
|
||||
}
|
||||
|
||||
# Step 4: 建立 PR
|
||||
pr_url = await self._create_pr(
|
||||
@@ -292,7 +298,7 @@ class DriftAdoptService:
|
||||
logger.info("drift_adopt_pr_created", report_id=report.report_id, pr_url=pr_url)
|
||||
return {
|
||||
"success": True,
|
||||
"message": f"PR 已建立,請 SRE review 後 merge",
|
||||
"message": "PR 已建立,請 SRE review 後 merge",
|
||||
"pr_url": pr_url,
|
||||
}
|
||||
|
||||
@@ -345,7 +351,9 @@ class DriftAdoptService:
|
||||
if not item.is_allowlisted
|
||||
}
|
||||
|
||||
for yaml_file in sorted(self._k8s_dir.glob("*.yaml")):
|
||||
for yaml_file in sorted(self._k8s_dir.rglob("*.yaml")):
|
||||
if not yaml_file.is_file():
|
||||
continue
|
||||
# 判斷此 YAML 是否與漂移相關
|
||||
file_stem = yaml_file.stem.lower()
|
||||
if not any(kind in file_stem for kind in affected_kinds):
|
||||
|
||||
Reference in New Issue
Block a user