Skip to content

Commit

Permalink
fix: 修复机器人修改议题等操作时仍会触发响应器的问题 (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 authored Dec 2, 2024
1 parent f814237 commit e554ee2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/
### Fixed

- 修复重新测试时没有提示测试进行中的问题
- 修复机器人修改议题等操作时仍会触发响应器的问题

## [4.1.1] - 2024-12-01

Expand Down
3 changes: 1 addition & 2 deletions src/plugins/github/depends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions tests/github/remove/process/test_remove_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit e554ee2

Please sign in to comment.