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

This commit is contained in:
2026-06-04 17:45:00 +08:00
parent 1d35a25c60
commit 03ee22c86d
3 changed files with 37 additions and 63 deletions

View File

@@ -261,40 +261,44 @@ def build_path_change_markdown(
push_time: str,
file_name: str,
) -> str:
"""构建 API路径变更通知匹配 model1.md 模板,并加强高亮
"""构建 API路径变更通知完全匹配 model1.md 模板,并加强视觉区分
支持的 change_type
- 新增接口:原路径显示 "-",新路径高亮显示
- 修改路径:原路径删除线,新路径高亮
- 删除接口:原路径高亮,新路径显示 "已删除"
改进点
- 标题使用【】风格
- 头部信息缩进 + 颜色高亮
- URI 详情使用列表(更直观)
- 根据变更类型动态强调「原/新路径」
"""
# 变更类型高亮
type_highlight = f"<font color=\"warning\">**{change_type}**</font>"
# 全路径类名高亮
class_highlight = f"<font color=\"info\">**{file_name}**</font>"
# 根据变更类型优化 URI 展示
if change_type == "新增接口":
old_display = "-"
new_display = f"<font color=\"info\">**`{new_uri}`**</font>"
old_display = "`-`"
new_display = f"<font color=\"info\">**`{new_uri}`**</font> ← <font color=\"info\">**新增**</font>"
elif change_type == "删除接口":
old_display = f"<font color=\"warning\">**`{old_uri}`**</font>"
new_display = "<font color=\"comment\">已删除</font>"
old_display = f"<font color=\"warning\">**`{old_uri}`**</font> ← <font color=\"warning\">**已删除**</font>"
new_display = "`已删除`"
else: # 修改路径
old_display = f"<font color=\"warning\">~~`{old_uri}`~~</font>" if old_uri else "-"
new_display = f"<font color=\"info\">**`{new_uri}`**</font>" if new_uri else "<font color=\"comment\">已删除</font>"
old_display = f"<font color=\"warning\">~~`{old_uri}`~~</font> ← <font color=\"warning\">**旧路径**</font>"
new_display = f"<font color=\"info\">**`{new_uri}`**</font> ← <font color=\"info\">**新路径**</font>"
parts = [
"# 【API路径变更通知】",
f"- **变更类型:** <font color=\"warning\">**{change_type}**</font>",
f"- **修改人:** {push_user}",
f"- **修改时间:** {push_time}",
f"- **全路径类名:** <font color=\"info\">**{file_name}**</font>",
"",
f" 变更类型: {type_highlight}",
f" 全路径类名: {class_highlight}",
f" 修改人: {push_user}",
f" 修改时间: {push_time}",
"",
"---",
"",
"## URI变更详情",
"",
"---",
"",
"| 项目 | 路径 |",
"|------|------|",
f"| 原路径 | {old_display} |",
f"| 新路径 | {new_display} |",
"#### 【URI变更详情",
f"- **原路径:** {old_display}",
f"- **新路径:** {new_display}",
"",
"---",
]