Gitlab Webhook: Support tag pushes

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2024-07-24 19:45:04 +02:00
parent edd0e0074a
commit c707aa5c35
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -33,6 +33,14 @@ impl From<GitlabHook> for Hook {
pub fn format_hook(glh: &GitlabHook) -> Option<String> {
Some(match glh {
GitlabHook::Push(push) if push.object_kind == "tag_push" => {
format!(
"[{}] {} pushed tag {}.",
push.project.name,
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