From b4bce43cccf3eaadd729940701255a7a8effb2aa Mon Sep 17 00:00:00 2001 From: uy/sun Date: Sat, 8 Apr 2023 10:19:15 +0800 Subject: [PATCH] =?UTF-8?q?improve:=20=E5=AE=A1=E6=9F=A5=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=90=8E=E5=A6=82=E6=9E=9C=E5=8F=AF=E5=90=88=E5=B9=B6=E5=88=99?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=90=88=E5=B9=B6=20(#124)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + src/plugins/publish/__init__.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) 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,