Capture Github event data from a test repository

Github's documentation is a little unclear on what data is actually
sent and in some cases conflicts with the examples in the
github-services repo.  The hope here is to capture a good sample of
different events to develop against and then use it in testing.

(imported from commit 356935894b87ca21591f5682c15f9ed27289a5b6)
This commit is contained in:
Zev Benjamin 2013-08-21 18:47:55 -04:00
parent 7b9d9bcdae
commit 9167b98820
1 changed files with 11 additions and 0 deletions

View File

@ -1764,6 +1764,17 @@ def api_github_landing(request, user_profile, event=REQ,
# TODO: this should all be moved to an external bot
repository = payload['repository']
# Special hook for capturing event data
try:
if (repository['owner']['login'] == 'zbenjamin'
and repository['name'] == 'zulip-test'
and payload['sender']['login'] == 'zbenjamin'):
with open('/var/log/humbug/github-payloads', 'a') as f:
f.write(ujson.dumps({'event': event, 'payload': payload}))
f.write("\n")
except Exception:
logging.error("Error while capturing Github event")
if not stream:
stream = 'commits'