Download:
child 219:744d45233209
parent 217:a5139d092b65
218:cb7fa90e604d
Anton Shestakov <av6@dwimlabs.net>, Wed, 24 Aug 2016 11:20:12 +0800
queue: add preliminary GithubHookHandler

1 файлов изменено, 18 вставок(+), 0 удалений(-) [+]
hooks-queue.py file | annotate | diff | comparison | revisions
--- a/hooks-queue.py Wed Aug 24 11:01:41 2016 +0800
+++ b/hooks-queue.py Wed Aug 24 11:20:12 2016 +0800
@@ -60,10 +60,28 @@
self.push(base, changes)
+class GithubHookHandler(BaseHookHandler):
+ def post(self):
+ payload = json.loads(self.request.body)
+ base = {
+ 'url': payload['repository']['html_url'],
+ 'scm': 'git',
+ 'repo': payload['repository']['name'],
+ 'timestamp': timestamp(),
+ 'source': 'github.com'
+ }
+
+ ref = payload['ref'].rpartition('/')[-1]
+ changes = [ref]
+
+ self.push(base, changes)
+
+
class CandolintHooks(Application):
def __init__(self, rconn, debug):
handlers = [
URLSpec(r'/bitbucket', BitbucketHookHandler),
+ URLSpec(r'/github', GithubHookHandler),
]
super(CandolintHooks, self).__init__(handlers, debug=debug)
self.rconn = rconn