mirror of
https://github.com/YunoHost/webhooks.git
synced 2024-09-03 19:56:54 +02:00
[fix] comment can be None
This commit is contained in:
parent
4ef8e19d8c
commit
6ff9ccdbb1
1 changed files with 8 additions and 1 deletions
|
@ -247,7 +247,14 @@ async def github(request):
|
||||||
pull_request_number = request.json["pull_request"]["number"]
|
pull_request_number = request.json["pull_request"]["number"]
|
||||||
pull_request_title = request.json["pull_request"]["title"]
|
pull_request_title = request.json["pull_request"]["title"]
|
||||||
url = request.json["pull_request"]["html_url"]
|
url = request.json["pull_request"]["html_url"]
|
||||||
comment = request.json["pull_request"]["body"].replace("\r\n", " ")
|
comment = request.json["pull_request"]["body"]
|
||||||
|
|
||||||
|
if comment and len(comment) > 120:
|
||||||
|
comment = ": " + comment[:120].replace("\r\n", " ") + "..."
|
||||||
|
elif not comment:
|
||||||
|
comment = ""
|
||||||
|
else:
|
||||||
|
comment = ": " + comment.replace("\r\n", " ")
|
||||||
|
|
||||||
if action in ("opened", "edited", "deleted", "transferred", "pinned",
|
if action in ("opened", "edited", "deleted", "transferred", "pinned",
|
||||||
"unpinned", "reopened"):
|
"unpinned", "reopened"):
|
||||||
|
|
Loading…
Reference in a new issue