mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
github_webhook: factor out is_test_repository function.
This commit is contained in:
@@ -13,6 +13,9 @@ COMMITS_IN_LIST_LIMIT = 10
|
|||||||
ZULIP_TEST_REPO_NAME = 'zulip-test'
|
ZULIP_TEST_REPO_NAME = 'zulip-test'
|
||||||
ZULIP_TEST_REPO_ID = 6893087
|
ZULIP_TEST_REPO_ID = 6893087
|
||||||
|
|
||||||
|
def is_test_repository(repository):
|
||||||
|
return repository['name'] == ZULIP_TEST_REPO_NAME and repository['id'] == ZULIP_TEST_REPO_ID
|
||||||
|
|
||||||
def github_generic_subject(noun, topic_focus, blob):
|
def github_generic_subject(noun, topic_focus, blob):
|
||||||
# issue and pull_request objects have the same fields we're interested in
|
# issue and pull_request objects have the same fields we're interested in
|
||||||
return "%s: %s %d: %s" % (topic_focus, noun, blob['number'], blob['title'])
|
return "%s: %s %d: %s" % (topic_focus, noun, blob['number'], blob['title'])
|
||||||
@@ -139,7 +142,7 @@ def api_github_landing(request, user_profile, event=REQ,
|
|||||||
|
|
||||||
# Special hook for capturing event data. If we see our special test repo, log the payload from github.
|
# Special hook for capturing event data. If we see our special test repo, log the payload from github.
|
||||||
try:
|
try:
|
||||||
if repository['name'] == ZULIP_TEST_REPO_NAME and repository['id'] == ZULIP_TEST_REPO_ID and settings.PRODUCTION:
|
if is_test_repository(repository) and settings.PRODUCTION:
|
||||||
with open('/var/log/zulip/github-payloads', 'a') as f:
|
with open('/var/log/zulip/github-payloads', 'a') as f:
|
||||||
f.write(ujson.dumps({'event': event,
|
f.write(ujson.dumps({'event': event,
|
||||||
'payload': payload,
|
'payload': payload,
|
||||||
|
|||||||
Reference in New Issue
Block a user