Skip to content

Commit

Permalink
fix: 统一测试按钮文本
Browse files Browse the repository at this point in the history
  • Loading branch information
BigOrangeQWQ committed Sep 2, 2024
1 parent 94d2c3f commit 086e5b1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/plugins/publish/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
PLUGIN_CONFIG_PATTERN = re.compile(r"### 插件配置项\s+```(?:\w+)?\s?([\s\S]*?)```")
PLUGIN_TEST_STRING = "插件测试"
PLUGIN_TEST_BUTTON_STRING = "- [x] 单击左侧按钮重新测试,完成时勾选框将被选中"
PLUGIN_TEST_BUTTON_PATTERN = re.compile(r"- \[([ |x])\] 单击左侧按钮重新测试")
PLUGIN_TEST_BUTTON_PATTERN = re.compile(
r"- \[([ |x])\] 单击左侧按钮重新测试,完成时勾选框将被选中"
)
PLUGIN_SUPPORTED_ADAPTERS_STRING = "插件支持的适配器"
PLUGIN_SUPPORTED_ADAPTERS_PATTERN = re.compile(
ISSUE_PATTERN.format(PLUGIN_SUPPORTED_ADAPTERS_STRING)
Expand Down
14 changes: 11 additions & 3 deletions src/plugins/publish/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,17 @@ async def ensure_issue_test_button(
issue_number=issue_number,
body=f"{issue_body}\n\n{new_content}",
)
logger.info("为议题添加插件测试按钮。")
else:
logger.info("议题内容中已包含插件测试按钮。")
logger.info("议题没有插件测试按钮,已添加")
elif search_result.group(1) == " ":
new_content = issue_body.replace(
search_result.group(0), PLUGIN_TEST_BUTTON_STRING
)
await bot.rest.issues.async_update(
**repo_info.model_dump(),
issue_number=issue_number,
body=new_content,
)
logger.info("议题中插件测试按钮未选中,已更新")


async def should_skip_plugin_publish(
Expand Down

0 comments on commit 086e5b1

Please sign in to comment.