Push hook: implement branch removal

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2023-06-01 12:19:26 +02:00
parent 9c54e7e1db
commit fd96e86f80
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -19,12 +19,13 @@ use log::debug;
pub fn format_webhook(wh: &WebHook) -> Option<String> {
Some(match wh {
WebHook::Push(push) => {
if push.commits.len() != 0 {
let mut text = format!(
"{} pushed {} commits to {} branch {}",
push.user_name,
push.commits.len(),
push.project.name,
push.ref_
push.ref_,
);
for commit in &push.commits {
match commit.message.lines().nth(0) {
@ -35,6 +36,14 @@ pub fn format_webhook(wh: &WebHook) -> Option<String> {
}
}
text
} else {
format!(
"{} deleted branch {} from {}",
push.user_name,
push.ref_,
push.project.name,
)
}
}
WebHook::Issue(issue) => {
let action = match issue.object_attributes.action {