Skip to content

Commit

Permalink
fix: 修复重新测试时没有提示测试进行中的问题 (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 authored Dec 2, 2024
1 parent bb79dde commit b7bbe4d
Show file tree
Hide file tree
Showing 3 changed files with 604 additions and 5 deletions.
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.1.1] - 2024-12-01

### Added
Expand Down
15 changes: 10 additions & 5 deletions src/plugins/github/plugins/publish/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ async def ensure_issue_plugin_test_button(handler: IssueHandler):
"""确保议题内容中包含插件测试按钮"""
issue_body = handler.issue.body or ""

new_content = f"{ISSUE_FIELD_TEMPLATE.format(PLUGIN_TEST_STRING)}\n\n{PLUGIN_TEST_BUTTON_STRING}"

match = PLUGIN_TEST_PATTERN.search(issue_body)
if not match:
new_content = f"{ISSUE_FIELD_TEMPLATE.format(PLUGIN_TEST_STRING)}\n\n{PLUGIN_TEST_BUTTON_STRING}"
new_content = f"{issue_body}\n\n{new_content}"
logger.info("为议题添加插件重测按钮")
else:
new_content = f"{ISSUE_FIELD_TEMPLATE.format(PLUGIN_TEST_STRING)}\n\n{PLUGIN_TEST_BUTTON_STRING}"
new_content = PLUGIN_TEST_PATTERN.sub(new_content, issue_body)
logger.info("重置插件重测按钮文本")

Expand All @@ -188,12 +188,17 @@ async def ensure_issue_plugin_test_button_in_progress(handler: IssueHandler):
"""确保议题内容中包含插件测试进行中的提示"""
issue_body = handler.issue.body or ""

new_content = f"{ISSUE_FIELD_TEMPLATE.format(PLUGIN_TEST_STRING)}\n\n{PLUGIN_TEST_BUTTON_IN_PROGRESS_STRING}"

match = PLUGIN_TEST_PATTERN.search(issue_body)
if not match:
new_content = f"{ISSUE_FIELD_TEMPLATE.format(PLUGIN_TEST_STRING)}\n\n{PLUGIN_TEST_BUTTON_IN_PROGRESS_STRING}"

await handler.update_issue_content(f"{issue_body}\n\n{new_content}")
new_content = f"{issue_body}\n\n{new_content}"
logger.info("为议题添加插件测试进行中的提示")
else:
new_content = PLUGIN_TEST_PATTERN.sub(new_content, issue_body)
logger.info("重置插件测试进行中文本")

await handler.update_issue_content(new_content)


async def process_pull_request(
Expand Down
Loading

0 comments on commit b7bbe4d

Please sign in to comment.