Skip to content

Commit 704505f

Browse files
committed
don't re-run command handlers when a pr title is edited
doing so leads to weird errors: > Could not assign reviewer from: jyn514. > User(s) jyn514 are either the PR author, already assigned, or on vacation, and there are no other candidates. > Use r? to specify someone else to assign. this was likely missed when transitioning from highfive to triagebot. see rust-lang/rust#118993 for an example of a bug this fixes
1 parent 92c3399 commit 704505f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/handlers.rs

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

0 commit comments

Comments
 (0)