Add Gitlab webhook

This commit is contained in:
Frédéric Guillot
2014-12-28 22:22:15 -05:00
parent d6530bd55f
commit 5266b82144
36 changed files with 597 additions and 58 deletions

View File

@@ -57,7 +57,27 @@ class Webhook extends Base
$result = $this->githubWebhook->parsePayload(
$this->request->getHeader('X-Github-Event'),
$this->request->getJson()
$this->request->getJson() ?: array()
);
echo $result ? 'PARSED' : 'IGNORED';
}
/**
* Handle Gitlab webhooks
*
* @access public
*/
public function gitlab()
{
if ($this->config->get('webhook_token') !== $this->request->getStringParam('token')) {
$this->response->text('Not Authorized', 401);
}
$this->gitlabWebhook->setProjectId($this->request->getIntegerParam('project_id'));
$result = $this->gitlabWebhook->parsePayload(
$this->request->getJson() ?: array()
);
echo $result ? 'PARSED' : 'IGNORED';