Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 6 additions & 11 deletions src/plugins/github/plugins/publish/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -122,7 +122,7 @@ async def render_comment(
url=homepage,
)
)
if action_url := data.get("action_url"):
if "action_url" in data:
Comment thread
he0119 marked this conversation as resolved.
card.append(
COMMENT_CARD_TEMPLATE.format(
name="测试结果",
Expand All @@ -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 条历史
Expand Down
32 changes: 32 additions & 0 deletions tests/plugins/github/publish/process/test_publish_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ async def test_bot_process_publish_check(
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 标签: test-#ffffff。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -259,6 +263,10 @@ async def test_adapter_process_publish_check(
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 项目 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI。</li><li>✅ 标签: test-#ffffff。</li><li>✅ 版本号: 0.0.1。</li><li>✅ 发布时间:2023-09-01 08:00:00 CST。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -437,6 +445,10 @@ async def test_edit_title(
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 标签: test-#ffffff。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -627,6 +639,10 @@ async def test_edit_title_too_long(
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 标签: test-#ffffff。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>⚠️ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -757,6 +773,10 @@ async def test_process_publish_check_not_pass(
<summary>详情</summary>
<pre><code><li>✅ 标签: test-#ffffff。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>⚠️ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -984,6 +1004,10 @@ async def test_convert_pull_request_to_draft(
<summary>详情</summary>
<pre><code><li>✅ 标签: test-#ffffff。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>⚠️ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -1117,6 +1141,10 @@ async def test_process_publish_check_ready_for_review(
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 标签: test-#ffffff。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -1302,6 +1330,10 @@ async def test_comment_immediate_after_pull_request_closed(
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 标签: test-#ffffff。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down
8 changes: 8 additions & 0 deletions tests/plugins/github/publish/render/test_publish_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ async def test_render_empty(app: App):
**✅ 所有测试通过,一切准备就绪!**


<details>
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -61,6 +65,10 @@ async def test_render_reuse(app: App):
**✅ 所有测试通过,一切准备就绪!**


<details>
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down
12 changes: 12 additions & 0 deletions tests/plugins/github/publish/render/test_publish_render_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ async def test_render_data_bot(app: App):
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://github.com/he0119/CoolQBot">主页</a> 返回状态码 200。</li></code></pre>
</details>
<details>
Comment thread
he0119 marked this conversation as resolved.
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -91,6 +95,10 @@ async def test_render_data_bot(app: App):
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://github.com/Mar-7th/March7th">主页</a> 返回状态码 200。</li><li>✅ 标签: StarRail-#5a8ccc, 星穹铁道-#6faec6。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -146,6 +154,10 @@ async def test_render_data_adapter(app: App):
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://github.com/CMHopeSunshine/nonebot-adapter-villa">主页</a> 返回状态码 200。</li><li>✅ 项目 <a href="https://pypi.org/project/nonebot-adapter-villa/">nonebot-adapter-villa</a> 已发布至 PyPI。</li><li>✅ 标签: 米哈游-#e10909。</li><li>✅ 版本号: 1.4.2。</li><li>✅ 发布时间:2023-12-21 14:57:44 CST。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>✅ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down
12 changes: 12 additions & 0 deletions tests/plugins/github/publish/render/test_publish_render_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ async def test_render_error_bot(app: App):

<pre><code><li>⚠️ 名称: 字符过多。<dt>请确保其不超过 50 个字符。</dt></li><li>⚠️ 项目 <a href="https://www.baidu.com">主页</a> 返回状态码 404。<dt>请确保你的项目主页可访问。</dt></li><li>⚠️ 第 2 个标签名称过长。<dt>请确保标签名称不超过 10 个字符。</dt></li><li>⚠️ 第 2 个标签颜色错误。<dt>请确保标签颜色符合十六进制颜色码规则。</dt></li></code></pre>

<details>
<summary>历史测试</summary>
<pre><code><li>⚠️ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
Comment thread
he0119 marked this conversation as resolved.
</details>

---

Expand Down Expand Up @@ -145,6 +149,10 @@ async def test_render_error_adapter(app: App):
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://pypi.org/project/nonebot-adapter-villa/">nonebot-adapter-villa</a> 已发布至 PyPI。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>⚠️ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down Expand Up @@ -314,6 +322,10 @@ async def test_render_error_plugin_load_test(app: App):
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://github.com/he0119/nonebot-plugin-treehelp">主页</a> 返回状态码 200。</li></code></pre>
</details>
<details>
<summary>历史测试</summary>
<pre><code><li>⚠️ <a href=https://github.com/owner/repo/actions/runs/123456>2023-08-23 09:22:14 CST</a></li></code></pre>
</details>

---

Expand Down
Loading