Skip to content

Commit

Permalink
feat: 发布检查时第一时间评论议题并修改标题 (#312)
Browse files Browse the repository at this point in the history
当信息验证做完之后,马上根据验证结果评论议题,给用户第一时间的反馈。
  • Loading branch information
he0119 authored Dec 5, 2024
1 parent 9bf11e6 commit 794b16a
Show file tree
Hide file tree
Showing 3 changed files with 298 additions and 297 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]

### Changed

- 发布检查时第一时间评论议题并修改标题

### Fixed

- 修复合并插件配置后没有删除对应分支和关闭议题的问题
Expand Down
18 changes: 9 additions & 9 deletions src/plugins/github/plugins/publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,23 @@ async def handle_pull_request_and_update_issue(
installation_id: int = Depends(get_installation_id),
) -> None:
async with bot.as_installation(installation_id):
branch_name = f"{BRANCH_NAME_PREFIX}{handler.issue_number}"
# 渲染评论信息
comment = await render_comment(validation, True)

# 对议题评论
await handler.comment_issue(comment)

# 设置拉取请求与议题的标题
# 限制标题长度,过长的标题不好看
title = f"{validation.type}: {validation.name[:TITLE_MAX_LENGTH]}"

# 渲染评论信息
comment = await render_comment(validation, True)

# 验证之后创建拉取请求和修改议题的标题
await process_pull_request(handler, validation, branch_name, title)

# 修改议题标题
await handler.update_issue_title(title)

# 对议题评论
await handler.comment_issue(comment)
branch_name = f"{BRANCH_NAME_PREFIX}{handler.issue_number}"

# 验证之后创建拉取请求和修改议题的标题
await process_pull_request(handler, validation, branch_name, title)


async def pr_close_rule(
Expand Down
Loading

0 comments on commit 794b16a

Please sign in to comment.