Skip to content

Commit 2bbb8b6

Browse files
authored
Merge pull request #1911 from ehuss/ignore-edited-no-changes
Ignore comment edited with no changes
2 parents d17ef9c + 92232b5 commit 2bbb8b6

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/handlers.rs

+19-4
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,25 @@ macro_rules! command_handlers {
246246
log::debug!("skipping event, issue was {:?}", e.action);
247247
return;
248248
}
249-
Event::IssueComment(e) => if e.action == IssueCommentAction::Deleted {
250-
// don't execute commands again when comment is deleted
251-
log::debug!("skipping event, comment was {:?}", e.action);
252-
return;
249+
Event::IssueComment(e) => {
250+
match e.action {
251+
IssueCommentAction::Created => {}
252+
IssueCommentAction::Edited => {
253+
if event.comment_from().is_none() {
254+
// We are not entirely sure why this happens.
255+
// Sometimes when someone posts a PR review,
256+
// GitHub sends an "edited" event with no
257+
// changes just before the "created" event.
258+
log::debug!("skipping issue comment edit without changes");
259+
return;
260+
}
261+
}
262+
IssueCommentAction::Deleted => {
263+
// don't execute commands again when comment is deleted
264+
log::debug!("skipping event, comment was {:?}", e.action);
265+
return;
266+
}
267+
}
253268
}
254269
Event::Push(_) | Event::Create(_) => {
255270
log::debug!("skipping unsupported event");

0 commit comments

Comments
 (0)