diff --git a/CHANGELOG.md b/CHANGELOG.md index b35b871f..a706bce2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/ ### Changed - 设置时区为中国 +- 审查通过后如果可合并则直接合并 ## [2.0.0] - 2023-04-07 diff --git a/src/plugins/publish/__init__.py b/src/plugins/publish/__init__.py index 84df1fae..60421b1d 100644 --- a/src/plugins/publish/__init__.py +++ b/src/plugins/publish/__init__.py @@ -228,10 +228,15 @@ async def auto_merge( **repo_info.dict(), pull_number=event.payload.pull_request.number ) ).parsed_data - # 需要先获取远程分支,否则无法切换到对应分支 - run_shell_command(["git", "fetch", "origin", plugin_config.input_config.base]) - # 直接尝试处理冲突,如果没有变化则不会提交 - await resolve_conflict_pull_requests(bot, repo_info, [pull_request]) + + if not pull_request.mergeable: + # 需要先获取远程分支,否则无法切换到对应分支 + run_shell_command( + ["git", "fetch", "origin", plugin_config.input_config.base] + ) + # 尝试处理冲突 + await resolve_conflict_pull_requests(bot, repo_info, [pull_request]) + await bot.rest.pulls.async_merge( **repo_info.dict(), pull_number=event.payload.pull_request.number,