diff --git a/src/webhook.rs b/src/webhook.rs index 53b27e1..42f5bb3 100644 --- a/src/webhook.rs +++ b/src/webhook.rs @@ -27,7 +27,8 @@ pub fn format_webhook(wh: &WebHook) -> Option { push.commits.len(), push.ref_, ); - for commit in &push.commits { + // Display max 3 commits + for commit in push.commits.clone().into_iter().take(3) { match commit.message.lines().nth(0) { Some(subject) => { text = format!("{}\n• {} <{}>", text, subject, commit.url); @@ -37,15 +38,13 @@ pub fn format_webhook(wh: &WebHook) -> Option { } text } else { - format!( - "[{}] {} deleted branch {}", - push.project.name, push.user_name, push.ref_, - ) + // Ignore: Branch got deleted + return None; } } WebHook::Issue(issue) => { let action = match issue.object_attributes.action { - Some(IssueAction::Update) => "updated", + Some(IssueAction::Update) => return None, Some(IssueAction::Open) => "opened", Some(IssueAction::Close) => "closed", Some(IssueAction::Reopen) => "reopened", @@ -68,7 +67,7 @@ pub fn format_webhook(wh: &WebHook) -> Option { } WebHook::MergeRequest(merge_req) => { let action = match merge_req.object_attributes.action { - Some(MergeRequestAction::Update) => "updated", + Some(MergeRequestAction::Update) => return None, Some(MergeRequestAction::Open) => "opened", Some(MergeRequestAction::Close) => "closed", Some(MergeRequestAction::Reopen) => "reopened",