webhook: Expose Note (comments) event
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
3943ba0924
commit
5f8b7d1c17
1 changed files with 25 additions and 2 deletions
|
@ -94,9 +94,32 @@ pub fn format_webhook(wh: &WebHook) -> Option<String> {
|
|||
)
|
||||
}
|
||||
WebHook::Note(note) => {
|
||||
println!("Note: {:?}", note);
|
||||
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);
|
||||
return None;
|
||||
|
|
Loading…
Reference in a new issue