github-webhook-forwarding
Version:
Forwards Github Webhooks to overcome the maximum number of webhooks allowed by Github (20)
20 lines (17 loc) • 520 B
JavaScript
var getHooks = require('../../lib/github/gethooks')
var removeHook = require('../../lib/github/removehook')
module.exports = exports = function (config) {
return getHooks(config)
.then((hooks) => {
return Promise.all(hooks.filter((item) => {
if (item.config.url === config.callbackURL && item.events.indexOf('push') !== -1) {
return true
} else {
return false
}
}).map((item) => {
return removeHook(config, item.id)
}))
})
}