From 92232b55e6d857b8eef447d808a8de848fcb076c Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 26 Feb 2025 06:37:25 -0800 Subject: [PATCH] Ignore comment edited with no changes --- src/handlers.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/handlers.rs b/src/handlers.rs index f59b6295..19d1aa25 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -246,10 +246,25 @@ macro_rules! command_handlers { log::debug!("skipping event, issue was {:?}", e.action); return; } - Event::IssueComment(e) => if e.action == IssueCommentAction::Deleted { - // don't execute commands again when comment is deleted - log::debug!("skipping event, comment was {:?}", e.action); - return; + Event::IssueComment(e) => { + match e.action { + IssueCommentAction::Created => {} + IssueCommentAction::Edited => { + if event.comment_from().is_none() { + // We are not entirely sure why this happens. + // Sometimes when someone posts a PR review, + // GitHub sends an "edited" event with no + // changes just before the "created" event. + log::debug!("skipping issue comment edit without changes"); + return; + } + } + IssueCommentAction::Deleted => { + // don't execute commands again when comment is deleted + log::debug!("skipping event, comment was {:?}", e.action); + return; + } + } } Event::Push(_) | Event::Create(_) => { log::debug!("skipping unsupported event");