From f70b5f8aa113ac30df336c16e15124bf614f73e7 Mon Sep 17 00:00:00 2001 From: xmppftw Date: Wed, 7 Aug 2024 10:58:51 +0200 Subject: [PATCH] Don't crash for unknown MR action --- src/hook.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hook.rs b/src/hook.rs index c58610b..7a649f8 100644 --- a/src/hook.rs +++ b/src/hook.rs @@ -40,7 +40,7 @@ pub fn format_hook(glh: &GitlabHook) -> Option { push.user_name, push.ref_.strip_prefix("refs/tags/").unwrap_or("?!"), ) - }, + } GitlabHook::Push(push) => { if push.ref_ != "refs/heads/main" { // Ignore: Action not on 'main' branch @@ -99,7 +99,13 @@ pub fn format_hook(glh: &GitlabHook) -> Option { Some(MergeRequestAction::Reopen) => "reopened", Some(MergeRequestAction::Merge) => "merged", None => return None, - _ => todo!(), + _ => { + log::warn!( + "Unsupported merge request action: {:?}", + merge_req.object_attributes.action + ); + return None; + } }; format!( "[{}] {} {} merge request {}: {}{}",