py修改
Some checks failed
API接口参数变更检测 / api-param-check (push) Has been cancelled

This commit is contained in:
2026-06-04 16:57:08 +08:00
parent 2d7bba4b91
commit 48dc5ac8e4
2 changed files with 101 additions and 39 deletions

View File

@@ -47,7 +47,6 @@ def _format_endpoint_block(report: EndpointChangeReport) -> str:
detail_lines.append("### <font color=\"warning\">参数变更明细</font>")
if report.parameter_changes:
# 简化:使用列表格式匹配模板
for change in report.parameter_changes:
md = change.to_markdown_line(plain=report.is_new_endpoint)
detail_lines.append(md)
@@ -72,19 +71,41 @@ def build_markdown_notification(
:param llm_summary: LLM 兼容性摘要(可选,简短)
:return: Markdown 文本
"""
parts = [
"# API参数变更通知",
f"- **变更类型:** 修改参数",
f"- **修改人:** {push_user}",
f"- **修改时间:** {push_time}",
"",
]
parts: List[str] = []
# 新增 Controller全部为新接口与变更接口分组
# 分组:路径变更、参数变更、新增、删除
renamed_reports = [r for r in reports if r.is_renamed_endpoint]
new_reports = [r for r in reports if r.is_new_endpoint]
changed_reports = [r for r in reports if not r.is_new_endpoint and not r.is_removed_endpoint]
changed_reports = [
r for r in reports
if not r.is_new_endpoint and not r.is_removed_endpoint and not r.is_renamed_endpoint
]
removed_reports = [r for r in reports if r.is_removed_endpoint]
# 路径变更优先使用 model1.md 模板
for report in renamed_reports:
old_uri = report.old_uri or "-"
new_uri = report.uri or "已删除"
path_md = build_path_change_markdown(
old_uri=old_uri,
new_uri=new_uri,
change_type="修改路径",
push_user=push_user,
push_time=push_time,
file_name=report.controller_class,
)
parts.append(path_md)
parts.append("")
if new_reports or changed_reports or removed_reports:
parts.extend([
"# API参数变更通知",
f"- **变更类型:** 修改参数",
f"- **修改人:** {push_user}",
f"- **修改时间:** {push_time}",
"",
])
for report in new_reports:
parts.append(_format_endpoint_block(report))
parts.append("")