github-webhook-forwarding
Version:
Forwards Github Webhooks to overcome the maximum number of webhooks allowed by Github (20)
21 lines (18 loc) • 510 B
JavaScript
var log = require('npmlog')
var _find = require('lodash.find')
var getHooks = require('./github/gethooks')
var createHook = require('./github/createhook')
module.exports = exports = function (config) {
return getHooks(config)
.then((hooks) => {
var pushHook = _find(hooks, (hook) => {
return hook.config.url === config.callbackURL
})
if (!pushHook) {
return createHook(config)
} else {
log.info('We already have a hook :)')
}
})
}