From e554ee259b641e2600eff048182b1f70f35238ee Mon Sep 17 00:00:00 2001 From: uy/sun Date: Mon, 2 Dec 2024 21:52:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA=E4=BF=AE=E6=94=B9=E8=AE=AE=E9=A2=98=E7=AD=89=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=97=B6=E4=BB=8D=E4=BC=9A=E8=A7=A6=E5=8F=91=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E5=99=A8=E7=9A=84=E9=97=AE=E9=A2=98=20(#307)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + src/plugins/github/depends/__init__.py | 3 +-- tests/github/remove/process/test_remove_check.py | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb3a8d74..acebeb87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/ ### Fixed - 修复重新测试时没有提示测试进行中的问题 +- 修复机器人修改议题等操作时仍会触发响应器的问题 ## [4.1.1] - 2024-12-01 diff --git a/src/plugins/github/depends/__init__.py b/src/plugins/github/depends/__init__.py index 06ceddd3..6755ac11 100644 --- a/src/plugins/github/depends/__init__.py +++ b/src/plugins/github/depends/__init__.py @@ -95,8 +95,7 @@ def is_bot_triggered_workflow(event: IssuesEvent): return True if ( isinstance(event, IssuesOpened | IssuesReopened | IssuesEdited) - and event.payload.issue.user - and event.payload.issue.user.type == "Bot" + and event.payload.sender.type == "Bot" ): logger.info("议题操作来自机器人,已跳过") return True diff --git a/tests/github/remove/process/test_remove_check.py b/tests/github/remove/process/test_remove_check.py index 708b9906..ee6a0611 100644 --- a/tests/github/remove/process/test_remove_check.py +++ b/tests/github/remove/process/test_remove_check.py @@ -895,3 +895,13 @@ async def test_process_trigger_by_bot(app: App): event.payload.comment.user.type = "Bot" ctx.receive_event(bot, event) + ctx.should_not_pass_rule() + + async with app.test_matcher() as ctx: + adapter, bot = get_github_bot(ctx) + event = get_mock_event(IssuesOpened) + assert event.payload.sender.type + event.payload.sender.type = "Bot" + + ctx.receive_event(bot, event) + ctx.should_not_pass_rule()