Skip to content

Commit

Permalink
Merge pull request #1911 from ehuss/ignore-edited-no-changes
Browse files Browse the repository at this point in the history
Ignore comment edited with no changes
  • Loading branch information
ehuss authored Feb 28, 2025
2 parents d17ef9c + 92232b5 commit 2bbb8b6
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 2bbb8b6

Please sign in to comment.