Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore comment edited with no changes #1911

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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