diff --git a/src/webhook.rs b/src/webhook.rs index 6c42527..8753822 100644 --- a/src/webhook.rs +++ b/src/webhook.rs @@ -94,8 +94,31 @@ pub fn format_webhook(wh: &WebHook) -> Option { ) } WebHook::Note(note) => { - println!("Note: {:?}", note); - return None; + if let Some(_) = note.snippet { + return None; + } + if let Some(commit) = ¬e.commit { + format!( + "[{}] {} commented on commit {:?} <{}>", + note.project.name, note.user.name, commit.id, commit.url, + ) + } else if let Some(issue) = ¬e.issue { + format!( + "[{}] {} commented on issue {}: {} <{}>", + note.project.name, + note.user.name, + issue.iid, + issue.title, + note.object_attributes.url, + ) + } else if let Some(mr) = ¬e.merge_request { + format!( + "[{}] {} commented on merge request {}: {} <{}>", + note.project.name, note.user.name, mr.iid, mr.title, note.object_attributes.url, + ) + } else { + unreachable!() + } } WebHook::Build(build) => { println!("Build: {:?}", build);