py修改
All checks were successful
API接口参数变更检测 / api-param-check (push) Successful in 17s

This commit is contained in:
2026-06-05 10:44:23 +08:00
parent ef2a16e7b3
commit 26cdde9344

View File

@@ -75,6 +75,9 @@ def build_markdown_notification(
"""
parts: List[str] = []
# 统一格式化 @ 用户名
mention_user = push_user if push_user.startswith("@") else f"@{push_user}"
# 所有 API 级变更(新增、修改路径、修改请求方式、删除、参数变更)统一走 model1.md 路径变更通知
method_changed_reports = [r for r in reports if r.is_method_changed]
renamed_reports = [r for r in reports if r.is_renamed_endpoint]
@@ -144,7 +147,7 @@ def build_markdown_notification(
if changed_reports:
parts.append("# API参数变更通知")
parts.append(f"- **变更类型:** 修改参数")
parts.append(f"- **修改人:** {push_user}")
parts.append(f"- **修改人:** {mention_user}")
parts.append(f"- **修改时间:** {push_time}")
parts.append("")
for report in changed_reports:
@@ -288,6 +291,8 @@ def build_path_change_markdown(
- URI 详情使用列表(更直观)
- 「修改请求方式」额外展示方法变更
"""
mention_user = push_user if push_user.startswith("@") else f"@{push_user}"
# 变更类型高亮
type_highlight = f"<font color=\"warning\">**{change_type}**</font>"
@@ -310,7 +315,7 @@ def build_path_change_markdown(
"",
f" 变更类型: {type_highlight}",
f" 全路径类名: {class_highlight}",
f" 修改人: {push_user}",
f" 修改人: {mention_user}",
f" 修改时间: {push_time}",
"",
"---------------",
@@ -337,6 +342,8 @@ def build_method_change_markdown(
格式参考 model1.md但专门针对 HTTP 方法变更场景设计,
突出「原请求方式 → 新请求方式」的对比。
"""
mention_user = push_user if push_user.startswith("@") else f"@{push_user}"
type_highlight = '<font color="warning">**修改请求方式**</font>'
class_highlight = f'<font color="info">**{file_name}**</font>'
uri_highlight = f'<font color="info">**`{uri}`**</font>'
@@ -348,17 +355,16 @@ def build_method_change_markdown(
"",
f" 变更类型: {type_highlight}",
f" 全路径类名: {class_highlight}",
f" 修改人: {push_user}",
f" 修改人: {mention_user}",
f" 修改时间: {push_time}",
"",
"---",
"---------------------------------",
"",
"#### 【请求方式变更详情】",
f"- **URI** {uri_highlight}",
f"- **原请求方式:** {old_m}",
f"- **新请求方式:** {new_m} ← <font color=\"info\">**请求方式已变更**</font>",
"",
"---",
]
return "\n".join(parts).strip()