formatters: fix github format

This commit is contained in:
Guilhem Saurel 2021-08-28 00:40:56 +02:00
parent 7aa5df3871
commit d0c4cd4227
2 changed files with 3 additions and 3 deletions

View file

@ -22,8 +22,8 @@ def github(data, headers):
pusher, ref, a, b, c = [
data[k] for k in ["pusher", "ref", "after", "before", "compare"]
]
pusher = f"[{pusher['name']}](https://github.com/{pusher['name']})"
data["body"] = f"@{pusher} pushed on {ref}: [{b}{a}]({c}):\n\n"
pusher = f"[@{pusher['name']}](https://github.com/{pusher['name']})"
data["body"] = f"{pusher} pushed on {ref}: [{b}{a}]({c}):\n\n"
for commit in data["commits"]:
data["body"] += f"- [{commit['message']}]({commit['url']})\n"
else:

View file

@ -93,7 +93,7 @@ class GithubFormatterTest(unittest.IsolatedAsyncioTestCase):
before = "ac7d1d9647008145e9d0cf65d24744d0db4862b8"
after = "4bcdb25c809391baaabc264d9309059f9f48ead2"
GH = "https://github.com"
expected = f'<p>@<a href="{GH}/nim65s">nim65s</a> pushed on refs/heads/devel: '
expected = f'<p><a href="{GH}/nim65s">@nim65s</a> pushed on refs/heads/devel: '
expected += f'<a href="{GH}/nim65s/matrix-webhook/compare/ac7d1d964700...'
expected += f'4bcdb25c8093">{before}{after}</a>:</p>\n<ul>\n<li>'
expected += f'<a href="{GH}/nim65s/matrix-webhook/commit/{after}">'