fix: show full branch name on github webhook messages

This commit is contained in:
Zomatree
2025-04-22 16:13:03 +01:00
parent 2540860129
commit d2e83c94f3

View File

@@ -788,9 +788,7 @@ pub async fn webhook_execute_github(
r#ref, r#ref,
.. ..
}) => { }) => {
let Some(branch) = r#ref.split('/').nth(2) else { let branch = r#ref.split('/').skip(2).collect::<Vec<_>>().join("/");
return Ok(());
};
if forced { if forced {
let description = format!( let description = format!(
@@ -817,19 +815,22 @@ pub async fn webhook_execute_github(
commits.len(), commits.len(),
compare compare
); );
let commit_description = commits let commit_description = shorten_text(
.into_iter() &commits
.map(|commit| { .into_iter()
format!( .map(|commit| {
"[`{}`]({}) {} - {}", format!(
&commit.id[0..=7], "[`{}`]({}) {} - {}",
commit.url, &commit.id[0..=7],
shorten_text(&commit.message, 50), commit.url,
commit.author.name shorten_text(&commit.message, 50),
) commit.author.name
}) )
.collect::<Vec<String>>() })
.join("\n"); .collect::<Vec<String>>()
.join("\n"),
1000
);
SendableEmbed { SendableEmbed {
title: Some(event.sender.login), title: Some(event.sender.login),