mirror of
https://github.com/YunoHost/webhooks.git
synced 2024-09-03 19:56:54 +02:00
do not notify is the repo is 'apps_translations'
This commit is contained in:
parent
e94519c781
commit
93a6bab156
1 changed files with 6 additions and 15 deletions
21
server.py
21
server.py
|
@ -88,10 +88,15 @@ async def github(request):
|
||||||
print()
|
print()
|
||||||
print(f"Hook type: {hook_type}")
|
print(f"Hook type: {hook_type}")
|
||||||
|
|
||||||
|
repository = request.json["repository"]["name"]
|
||||||
|
|
||||||
|
# do not notify if the repo is 'apps_translations'
|
||||||
|
if repository == "apps_translations":
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# https://developer.github.com/v3/activity/events/types/#pushevent
|
# https://developer.github.com/v3/activity/events/types/#pushevent
|
||||||
if hook_type == "push":
|
if hook_type == "push":
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
commits = request.json["commits"]
|
commits = request.json["commits"]
|
||||||
user = request.json["pusher"]["name"]
|
user = request.json["pusher"]["name"]
|
||||||
branch = request.json["ref"].split("/", 2)[2]
|
branch = request.json["ref"].split("/", 2)[2]
|
||||||
|
@ -135,7 +140,6 @@ async def github(request):
|
||||||
|
|
||||||
# https://developer.github.com/v3/activity/events/types/#commitcommentevent
|
# https://developer.github.com/v3/activity/events/types/#commitcommentevent
|
||||||
elif hook_type == "commit_comment":
|
elif hook_type == "commit_comment":
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["comment"]["user"]["login"]
|
user = request.json["comment"]["user"]["login"]
|
||||||
commit_short_id = request.json["comment"]["commit_id"][:7]
|
commit_short_id = request.json["comment"]["commit_id"][:7]
|
||||||
comment = request.json["comment"]["body"].replace("\r\n", " ")
|
comment = request.json["comment"]["body"].replace("\r\n", " ")
|
||||||
|
@ -150,7 +154,6 @@ async def github(request):
|
||||||
elif hook_type == "create":
|
elif hook_type == "create":
|
||||||
kind = request.json["ref_type"]
|
kind = request.json["ref_type"]
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
|
|
||||||
if kind == "repository":
|
if kind == "repository":
|
||||||
await notify(
|
await notify(
|
||||||
|
@ -176,7 +179,6 @@ async def github(request):
|
||||||
elif hook_type == "delete":
|
elif hook_type == "delete":
|
||||||
kind = request.json["ref_type"]
|
kind = request.json["ref_type"]
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
|
|
||||||
ref = request.json["ref"]
|
ref = request.json["ref"]
|
||||||
await notify(
|
await notify(
|
||||||
|
@ -185,7 +187,6 @@ async def github(request):
|
||||||
|
|
||||||
# https://developer.github.com/v3/activity/events/types/#forkevent
|
# https://developer.github.com/v3/activity/events/types/#forkevent
|
||||||
elif hook_type == "fork":
|
elif hook_type == "fork":
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
forked_repository = request.json["forkee"]["full_name"]
|
forked_repository = request.json["forkee"]["full_name"]
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
url = request.json["forkee"]["html_url"]
|
url = request.json["forkee"]["html_url"]
|
||||||
|
@ -197,7 +198,6 @@ async def github(request):
|
||||||
|
|
||||||
# https://developer.github.com/v3/activity/events/types/#issuecommentevent
|
# https://developer.github.com/v3/activity/events/types/#issuecommentevent
|
||||||
elif hook_type == "issue_comment":
|
elif hook_type == "issue_comment":
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
url = request.json["comment"]["html_url"]
|
url = request.json["comment"]["html_url"]
|
||||||
issue_url = request.json["issue"]["html_url"]
|
issue_url = request.json["issue"]["html_url"]
|
||||||
|
@ -216,7 +216,6 @@ async def github(request):
|
||||||
# https://developer.github.com/v3/activity/events/types/#issuesevent
|
# https://developer.github.com/v3/activity/events/types/#issuesevent
|
||||||
elif hook_type == "issues":
|
elif hook_type == "issues":
|
||||||
action = request.json["action"]
|
action = request.json["action"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
issue_number = request.json["issue"]["number"]
|
issue_number = request.json["issue"]["number"]
|
||||||
url = request.json["issue"]["html_url"]
|
url = request.json["issue"]["html_url"]
|
||||||
|
@ -279,7 +278,6 @@ async def github(request):
|
||||||
elif hook_type == "label":
|
elif hook_type == "label":
|
||||||
action = request.json["action"]
|
action = request.json["action"]
|
||||||
label = request.json["label"]["name"]
|
label = request.json["label"]["name"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
|
|
||||||
await notify(
|
await notify(
|
||||||
|
@ -289,7 +287,6 @@ async def github(request):
|
||||||
# https://developer.github.com/v3/activity/events/types/#milestoneevent
|
# https://developer.github.com/v3/activity/events/types/#milestoneevent
|
||||||
elif hook_type == "milestone":
|
elif hook_type == "milestone":
|
||||||
action = request.json["action"]
|
action = request.json["action"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
milestone = request.json["milestone"]["title"]
|
milestone = request.json["milestone"]["title"]
|
||||||
|
|
||||||
|
@ -301,7 +298,6 @@ async def github(request):
|
||||||
# https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent
|
# https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent
|
||||||
elif hook_type == "pull_request_review_comment":
|
elif hook_type == "pull_request_review_comment":
|
||||||
action = request.json["action"]
|
action = request.json["action"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
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"]
|
||||||
|
@ -325,7 +321,6 @@ async def github(request):
|
||||||
# https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent
|
# https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent
|
||||||
elif hook_type == "pull_request_review":
|
elif hook_type == "pull_request_review":
|
||||||
action = request.json["action"]
|
action = request.json["action"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
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"]
|
||||||
|
@ -359,7 +354,6 @@ async def github(request):
|
||||||
# https://developer.github.com/v3/activity/events/types/#pullrequestevent
|
# https://developer.github.com/v3/activity/events/types/#pullrequestevent
|
||||||
elif hook_type == "pull_request":
|
elif hook_type == "pull_request":
|
||||||
action = request.json["action"]
|
action = request.json["action"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
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"]
|
||||||
|
@ -458,7 +452,6 @@ async def github(request):
|
||||||
# https://developer.github.com/v3/activity/events/types/#repositoryevent
|
# https://developer.github.com/v3/activity/events/types/#repositoryevent
|
||||||
elif hook_type == "repository":
|
elif hook_type == "repository":
|
||||||
action = request.json["action"]
|
action = request.json["action"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
url = request.json["repository"]["html_url"]
|
url = request.json["repository"]["html_url"]
|
||||||
description = request.json["repository"]["description"]
|
description = request.json["repository"]["description"]
|
||||||
|
@ -476,7 +469,6 @@ async def github(request):
|
||||||
# https://developer.github.com/v3/activity/events/types/#releaseevent
|
# https://developer.github.com/v3/activity/events/types/#releaseevent
|
||||||
elif hook_type == "release":
|
elif hook_type == "release":
|
||||||
action = request.json["action"]
|
action = request.json["action"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
url = request.json["release"]["html_url"]
|
url = request.json["release"]["html_url"]
|
||||||
release_tag = request.json["release"]["tag_name"]
|
release_tag = request.json["release"]["tag_name"]
|
||||||
|
@ -492,7 +484,6 @@ async def github(request):
|
||||||
state = request.json["state"]
|
state = request.json["state"]
|
||||||
description = request.json["description"]
|
description = request.json["description"]
|
||||||
target_url = request.json["target_url"]
|
target_url = request.json["target_url"]
|
||||||
repository = request.json["repository"]["name"]
|
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
url = request.json["commit"]["html_url"]
|
url = request.json["commit"]["html_url"]
|
||||||
commit_message = request.json["commit"]["commit"]["message"].replace(
|
commit_message = request.json["commit"]["commit"]["message"].replace(
|
||||||
|
|
Loading…
Reference in a new issue