Push hook: implement branch removal
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
9c54e7e1db
commit
fd96e86f80
1 changed files with 25 additions and 16 deletions
|
@ -19,22 +19,31 @@ use log::debug;
|
||||||
pub fn format_webhook(wh: &WebHook) -> Option<String> {
|
pub fn format_webhook(wh: &WebHook) -> Option<String> {
|
||||||
Some(match wh {
|
Some(match wh {
|
||||||
WebHook::Push(push) => {
|
WebHook::Push(push) => {
|
||||||
let mut text = format!(
|
if push.commits.len() != 0 {
|
||||||
"{} pushed {} commits to {} branch {}",
|
let mut text = format!(
|
||||||
push.user_name,
|
"{} pushed {} commits to {} branch {}",
|
||||||
push.commits.len(),
|
push.user_name,
|
||||||
push.project.name,
|
push.commits.len(),
|
||||||
push.ref_
|
push.project.name,
|
||||||
);
|
push.ref_,
|
||||||
for commit in &push.commits {
|
);
|
||||||
match commit.message.lines().nth(0) {
|
for commit in &push.commits {
|
||||||
Some(subject) => {
|
match commit.message.lines().nth(0) {
|
||||||
text = format!("{}\n• {} <{}>", text, subject, commit.url);
|
Some(subject) => {
|
||||||
}
|
text = format!("{}\n• {} <{}>", text, subject, commit.url);
|
||||||
None => {}
|
}
|
||||||
}
|
None => {}
|
||||||
}
|
}
|
||||||
text
|
}
|
||||||
|
text
|
||||||
|
} else {
|
||||||
|
format!(
|
||||||
|
"{} deleted branch {} from {}",
|
||||||
|
push.user_name,
|
||||||
|
push.ref_,
|
||||||
|
push.project.name,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
WebHook::Issue(issue) => {
|
WebHook::Issue(issue) => {
|
||||||
let action = match issue.object_attributes.action {
|
let action = match issue.object_attributes.action {
|
||||||
|
|
Loading…
Reference in a new issue