Don't crash for unknown MR action
This commit is contained in:
parent
f9e6b91451
commit
f70b5f8aa1
1 changed files with 8 additions and 2 deletions
10
src/hook.rs
10
src/hook.rs
|
@ -40,7 +40,7 @@ pub fn format_hook(glh: &GitlabHook) -> Option<String> {
|
||||||
push.user_name,
|
push.user_name,
|
||||||
push.ref_.strip_prefix("refs/tags/").unwrap_or("?!"),
|
push.ref_.strip_prefix("refs/tags/").unwrap_or("?!"),
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
GitlabHook::Push(push) => {
|
GitlabHook::Push(push) => {
|
||||||
if push.ref_ != "refs/heads/main" {
|
if push.ref_ != "refs/heads/main" {
|
||||||
// Ignore: Action not on 'main' branch
|
// Ignore: Action not on 'main' branch
|
||||||
|
@ -99,7 +99,13 @@ pub fn format_hook(glh: &GitlabHook) -> Option<String> {
|
||||||
Some(MergeRequestAction::Reopen) => "reopened",
|
Some(MergeRequestAction::Reopen) => "reopened",
|
||||||
Some(MergeRequestAction::Merge) => "merged",
|
Some(MergeRequestAction::Merge) => "merged",
|
||||||
None => return None,
|
None => return None,
|
||||||
_ => todo!(),
|
_ => {
|
||||||
|
log::warn!(
|
||||||
|
"Unsupported merge request action: {:?}",
|
||||||
|
merge_req.object_attributes.action
|
||||||
|
);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
format!(
|
format!(
|
||||||
"[{}] {} {} merge request {}: {}{}",
|
"[{}] {} {} merge request {}: {}{}",
|
||||||
|
|
Loading…
Reference in a new issue