Readd support for GitlabHook::WikiPage

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2024-08-31 23:25:53 +02:00 committed by pep
commit db88921290
3 changed files with 57 additions and 23 deletions

View file

@ -20,7 +20,7 @@ mod types;
pub use crate::hooks::forgejo::ForgejoHook;
pub use crate::hooks::gitlab::GitlabHook;
pub use crate::hooks::types::Hook;
use crate::hooks::types::{IssueAction, MergeRequestAction};
use crate::hooks::types::{IssueAction, MergeRequestAction, WikiAction};
pub fn format_hook(hook: &Hook) -> Option<String> {
Some(match hook {
@ -129,25 +129,16 @@ pub fn format_hook(hook: &Hook) -> Option<String> {
} else {
unreachable!()
}
} /*
Hook::WikiPage(page) => {
let action = match page.object_attributes.action {
WikiPageAction::Update => "updated",
WikiPageAction::Create => "created",
};
format!(
"[{}] {} {} wiki page {} <{}>",
page.project.name,
page.user.name,
action,
page.object_attributes.title,
page.object_attributes.url,
)
}
_ => {
debug!("Hook not supported");
return None;
}
*/
}
Hook::Wiki(page) => {
let action = match page.action {
WikiAction::Update => "updated",
WikiAction::Create => "created",
};
format!(
"[{}] {} {} wiki page {} <{}>",
page.repository.name, page.author.name, action, page.title, page.url,
)
}
})
}