diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3121a477..d9f18084 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/
## [Unreleased]
+### Fixed
+
+- 修复机器人/适配器发布时没有历史测试的问题
+
## [4.4.0] - 2025-06-17
### Added
diff --git a/src/plugins/github/plugins/publish/render.py b/src/plugins/github/plugins/publish/render.py
index 58fb8638..9c41c9aa 100644
--- a/src/plugins/github/plugins/publish/render.py
+++ b/src/plugins/github/plugins/publish/render.py
@@ -84,14 +84,14 @@ async def render_comment(
history = history or []
+ action_url = f"https://github.com/{plugin_config.github_repository}/actions/runs/{plugin_config.github_run_id}"
if result.type == PublishType.PLUGIN:
# https://github.com/he0119/action-test/actions/runs/4469672520
# 仅在测试通过或跳过测试时显示
# 如果 load 为 False 的时候 valid_data 里面没有 load 字段,所以直接用 raw_data
if result.raw_data["load"] or result.raw_data["skip_test"]:
- valid_data["action_url"] = (
- f"https://github.com/{plugin_config.github_repository}/actions/runs/{plugin_config.github_run_id}"
- )
+ valid_data["action_url"] = action_url
+
# 如果 tags 字段为空则不显示
if not valid_data.get("tags"):
valid_data.pop("tags", None)
@@ -122,7 +122,7 @@ async def render_comment(
url=homepage,
)
)
- if action_url := data.get("action_url"):
+ if "action_url" in data:
card.append(
COMMENT_CARD_TEMPLATE.format(
name="测试结果",
@@ -132,14 +132,9 @@ async def render_comment(
url=action_url,
)
)
- history.append(
- (
- result.valid,
- action_url,
- datetime.now(tz=TIME_ZONE),
- )
- )
+ # 添加历史测试
+ history.append((result.valid, action_url, datetime.now(tz=TIME_ZONE)))
# 测试历史应该时间倒序排列
history.sort(key=lambda x: x[2], reverse=True)
# 限制最多显示 10 条历史
diff --git a/tests/plugins/github/publish/process/test_publish_check.py b/tests/plugins/github/publish/process/test_publish_check.py
index ef8570c9..0b5d81cb 100644
--- a/tests/plugins/github/publish/process/test_publish_check.py
+++ b/tests/plugins/github/publish/process/test_publish_check.py
@@ -100,6 +100,10 @@ async def test_bot_process_publish_check(
✅ 项目 主页 返回状态码 200。 ✅ 标签: test-#ffffff。
+✅ 2023-08-23 09:22:14 CST
+✅ 项目 主页 返回状态码 200。 ✅ 项目 project_link 已发布至 PyPI。 ✅ 标签: test-#ffffff。 ✅ 版本号: 0.0.1。 ✅ 发布时间:2023-09-01 08:00:00 CST。
+✅ 2023-08-23 09:22:14 CST
+✅ 项目 主页 返回状态码 200。 ✅ 标签: test-#ffffff。
+✅ 2023-08-23 09:22:14 CST
+✅ 项目 主页 返回状态码 200。 ✅ 标签: test-#ffffff。
+⚠️ 2023-08-23 09:22:14 CST
+✅ 标签: test-#ffffff。
+⚠️ 2023-08-23 09:22:14 CST
+✅ 标签: test-#ffffff。
+⚠️ 2023-08-23 09:22:14 CST
+✅ 项目 主页 返回状态码 200。 ✅ 标签: test-#ffffff。
+✅ 2023-08-23 09:22:14 CST
+✅ 项目 主页 返回状态码 200。 ✅ 标签: test-#ffffff。
+✅ 2023-08-23 09:22:14 CST
+✅ 2023-08-23 09:22:14 CST
+✅ 2023-08-23 09:22:14 CST
+✅ 项目 主页 返回状态码 200。
+✅ 2023-08-23 09:22:14 CST
+✅ 项目 主页 返回状态码 200。 ✅ 标签: StarRail-#5a8ccc, 星穹铁道-#6faec6。
+✅ 2023-08-23 09:22:14 CST
+✅ 项目 主页 返回状态码 200。 ✅ 项目 nonebot-adapter-villa 已发布至 PyPI。 ✅ 标签: 米哈游-#e10909。 ✅ 版本号: 1.4.2。 ✅ 发布时间:2023-12-21 14:57:44 CST。
+✅ 2023-08-23 09:22:14 CST
+⚠️ 名称: 字符过多。请确保其不超过 50 个字符。 ⚠️ 项目 主页 返回状态码 404。请确保你的项目主页可访问。 ⚠️ 第 2 个标签名称过长。请确保标签名称不超过 10 个字符。 ⚠️ 第 2 个标签颜色错误。请确保标签颜色符合十六进制颜色码规则。
+⚠️ 2023-08-23 09:22:14 CST
+✅ 项目 nonebot-adapter-villa 已发布至 PyPI。
+⚠️ 2023-08-23 09:22:14 CST
+✅ 项目 主页 返回状态码 200。
+⚠️ 2023-08-23 09:22:14 CST
+