From 5f659fc1e4061593af25bdd90a95b7427f3dbd5e Mon Sep 17 00:00:00 2001 From: muhammad-a-dev <96878085+muhammad-a-dev@users.noreply.github.com> Date: Fri, 16 Oct 2026 11:30:39 +0500 Subject: [PATCH] Only react to the re-review phrase when changes were requested Closes #687 --- bedevere/stage.py | 3 +++ tests/test_stage.py | 26 ++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/bedevere/stage.py b/bedevere/stage.py index 57d8d62f..c906b088 100644 --- a/bedevere/stage.py +++ b/bedevere/stage.py @@ -259,6 +259,9 @@ async def new_comment(event, gh, *args, **kwargs): elif not any(trigger.lower() in comment_body for trigger in TRIGGERS): # PR creator didn't request another review. return + elif Blocker.changes.value not in util.labels(issue): + # No changes were requested, so there is nothing to re-review. + return else: if FUN_TRIGGER_PHRASE.lower() in comment_body: thanks = FUN_THANKS diff --git a/tests/test_stage.py b/tests/test_stage.py index 4a1551ec..05add0ad 100644 --- a/tests/test_stage.py +++ b/tests/test_stage.py @@ -832,12 +832,34 @@ async def test_new_comment(): await awaiting.router.dispatch(event, gh) assert not len(gh.post_) + # Comment from PR author with trigger phrase, but no changes were requested. + data = { + "action": "created", + "issue": { + "user": {"login": "andreamcinnes"}, + "labels": [{"name": awaiting.Blocker.review.value}], + "labels_url": "https://api.github.com/labels/42", + "url": "https://api.github.com/issue/42", + "pull_request": {"url": "https://api.github.com/pr/42"}, + "comments_url": "https://api.github.com/comments/42", + }, + "comment": { + "user": {"login": "andreamcinnes"}, + "body": awaiting.BORING_TRIGGER_PHRASE, + }, + } + event = sansio.Event(data, event="issue_comment", delivery_id="12345") + gh = FakeGH() + await awaiting.router.dispatch(event, gh) + assert not len(gh.post_) + assert not gh.delete_url + # Everything is right with the world. data = { "action": "created", "issue": { "user": {"login": "andreamcinnes"}, - "labels": [], + "labels": [{"name": awaiting.Blocker.changes.value}], "labels_url": "https://api.github.com/labels/42", "url": "https://api.github.com/issue/42", "pull_request": {"url": "https://api.github.com/pr/42"}, @@ -886,7 +908,7 @@ async def test_new_comment(): "action": "created", "issue": { "user": {"login": "andreamcinnes"}, - "labels": [], + "labels": [{"name": awaiting.Blocker.changes.value}], "labels_url": "https://api.github.com/labels/42", "url": "https://api.github.com/issue/42", "pull_request": {"url": "https://api.github.com/pr/42"},