add branch names in push messages

This commit is contained in:
Lephenixnoir 2021-12-31 11:20:08 +01:00
parent bdb7805d40
commit 47fea7b77d
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 5 additions and 1 deletions

6
app.py
View File

@ -57,8 +57,12 @@ def main():
msg = f"{url_user} a créé une nouvelle branche {url_branch} dans {url_repository} : {message}{others}"
# Pre-existing branch
else:
if data["ref"].startswith("refs/heads/"):
branch = " (branche " + data["ref"][11:] + ")"
else:
branch = ""
url_commits = f"[url={data['compare_url']}]{commit_count}[/url]"
msg = f"{url_user} a poussé {url_commits} dans {url_repository} : {message}{others}"
msg = f"{url_user} a poussé {url_commits} dans {url_repository}{branch} : {message}{others}"
if event == "push" and data["ref"].startswith("refs/tags/"):
url_user = make_url_user(data['pusher'])