From 2d78329860795c8a2a4f2cd4eb8cd09945a93294 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 1 Feb 2017 00:12:49 +0900 Subject: #52 --- src/api/service/github.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/api/service/github.ts (limited to 'src/api/service') diff --git a/src/api/service/github.ts b/src/api/service/github.ts new file mode 100644 index 0000000000..680c02c47a --- /dev/null +++ b/src/api/service/github.ts @@ -0,0 +1,18 @@ +import * as express from 'express'; +const createHandler = require('github-webhook-handler'); +import config from '../../conf'; + +module.exports = (app: express.Application) => { + if (config.github_bot == null) return; + + const handler = createHandler({ + path: '/hooks/github', + secret: config.github_bot.hook_secret + }); + + app.post('/hooks/github', handler); + + handler.on('*', event => { + console.dir(event); + }); +}; -- cgit v1.2.3-freya