From 64453a0b727eb42468ffd8bb695a48a10a640842 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Sun, 23 Apr 2023 17:57:08 +0100 Subject: [PATCH] Dev webhook fixes --- .github/workflow_data/webhook.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflow_data/webhook.py b/.github/workflow_data/webhook.py index 2b9e29da9..ee97e254b 100644 --- a/.github/workflow_data/webhook.py +++ b/.github/workflow_data/webhook.py @@ -24,12 +24,13 @@ if __name__ == "__main__": else f"{count} New Commit{'' if count == 1 else 's'}" ) desc = f"[**{change}**]({event['compare']}) | [{branch}]({event['repository']['html_url']}/tree/{branch})\n" - for commit in event["commits"][:10]: - msg = commit['message'].splitlines()[0] + for i, commit in enumerate(event["commits"]): + msg = commit['message'].splitlines()[0].replace("`", "") msg = msg[:50] + ("..." if len(msg) > 50 else "") desc += f"\n[`{commit['id'][:7]}`]({commit['url']}): {msg} - [__{commit['author']['username']}__](https://github.com/{commit['author']['username']})" - if count > 10: - desc += f"\n+ {count - 10} more commits" + if len(desc) > 2020: + desc = desc.rsplit("\n", 1)[0] + f"\n+ {count - i} more commits" + break url = event["compare"] color = 16723712 if event["forced"] else 3669797