mirror of
https://github.com/YunoHost/webhooks.git
synced 2024-09-03 19:56:54 +02:00
[enh] handle create event
This commit is contained in:
parent
e749200f6c
commit
10f7506292
1 changed files with 17 additions and 0 deletions
17
server.py
17
server.py
|
@ -79,6 +79,23 @@ async def github(request):
|
|||
|
||||
notify(f"[{repository}] @{user} comment on commit {commit_short_id}: {comment} {url}")
|
||||
|
||||
# https://developer.github.com/v3/activity/events/types/#createevent
|
||||
elif hook_type == "create":
|
||||
kind = request.json["ref_type"]
|
||||
user = request.json["sender"]["login"]
|
||||
repository = request.json["repository"]["name"]
|
||||
|
||||
if kind == "repository":
|
||||
f"@{user} created new repository {repository}: {url}"
|
||||
elif kind == "branch":
|
||||
branch = request.json["ref"]
|
||||
f"[{repository}] @{user} created new branch {branch}"
|
||||
elif kind == "tag":
|
||||
tag = request.json["ref"]
|
||||
f"[{repository}] @{user} created new tag {tag}"
|
||||
else:
|
||||
print(f"WARNING: unknown 'create' even kind: {kind}")
|
||||
|
||||
return text("ok")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue