diff --git a/routes/webhook.js b/routes/webhook.js index 396f24d..9c252ce 100644 --- a/routes/webhook.js +++ b/routes/webhook.js @@ -16,7 +16,7 @@ router.post('/', wrap(function* (request, response, next) { return warn(request, response, 'Webhooks not enabled'); } const deliveryId = request.headers['x-github-delivery']; - getLogger().verbose('Received', `Webhook event`, { delivery: deliveryId }); + getLogger().verbose('Received', 'Webhook event', { delivery: deliveryId }); const signature = request.headers['x-hub-signature']; const eventType = request.headers['x-github-event']; @@ -24,6 +24,12 @@ router.post('/', wrap(function* (request, response, next) { return fatal(request, response, 'Missing signature or event type on GitHub webhook'); } + // Ignoring since check events aren't useful for now and constitute over 99% of the events traffic. + if (['check_run', 'check_suite'].includes(eventType)) { + getLogger().info('Ignored', 'Webhook event', { delivery: deliveryId, eventType, signature }); + return response.status(200); + } + const data = request.body; const computedSignature = 'sha1=' + crypto.createHmac('sha1', webhookSecret).update(data).digest('hex'); if (!crypto.timingSafeEqual(new Buffer(signature), new Buffer(computedSignature))) {