Skip to content

Commit 413f9d4

Browse files
authored
Merge pull request #1755 from jyn514/pr-edit
don't try to reassign a reviewer when a pr title is edited
2 parents 2dd37fa + 1ac30e8 commit 413f9d4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/handlers.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,17 @@ macro_rules! command_handlers {
180180
errors: &mut Vec<HandlerError>,
181181
) {
182182
match event {
183-
Event::Issue(e) => if !matches!(e.action, IssuesAction::Opened | IssuesAction::Edited) {
183+
// always handle new PRs / issues
184+
Event::Issue(IssuesEvent { action: IssuesAction::Opened, .. }) => {},
185+
Event::Issue(IssuesEvent { action: IssuesAction::Edited, .. }) => {
186+
// if the issue was edited, but we don't get a `changes[body]` diff, it means only the title was edited, not the body.
187+
// don't process the same commands twice.
188+
if event.comment_from().is_none() {
189+
log::debug!("skipping title-only edit event");
190+
return;
191+
}
192+
},
193+
Event::Issue(e) => {
184194
// no change in issue's body for these events, so skip
185195
log::debug!("skipping event, issue was {:?}", e.action);
186196
return;

0 commit comments

Comments
 (0)