[fix] maximize commit message len + remove endl

This commit is contained in:
Laurent Peuch 2019-02-06 13:16:20 +01:00
parent 2642c4f5f8
commit 602523c1e8

View file

@ -67,7 +67,11 @@ async def github(request):
notify(f"[{repository}] @{user} pushed {len(commits)} commits to {branch}: {url}") notify(f"[{repository}] @{user} pushed {len(commits)} commits to {branch}: {url}")
for commit in commits[-5:]: for commit in commits[-5:]:
author = commit["author"]["name"] author = commit["author"]["name"]
commit_message = commit["message"] commit_message = commit["message"].replace("\n", " ")
if len(commit_message) > 120:
commit_message = commit_message[120:] + "..."
notify(f"[{repository}/{branch}] {commit_message} - {author}") notify(f"[{repository}/{branch}] {commit_message} - {author}")
# https://developer.github.com/v3/activity/events/types/#commitcommentevent # https://developer.github.com/v3/activity/events/types/#commitcommentevent