Add Bitbucket webhook

This commit is contained in:
Frederic Guillot
2015-02-08 21:13:59 -05:00
parent 02f7c8d33d
commit 6f94ce6af3
24 changed files with 279 additions and 1 deletions

View File

@@ -82,4 +82,22 @@ class Webhook extends Base
echo $result ? 'PARSED' : 'IGNORED';
}
/**
* Handle Bitbucket webhooks
*
* @access public
*/
public function bitbucket()
{
if ($this->config->get('webhook_token') !== $this->request->getStringParam('token')) {
$this->response->text('Not Authorized', 401);
}
$this->bitbucketWebhook->setProjectId($this->request->getIntegerParam('project_id'));
$result = $this->bitbucketWebhook->parsePayload(json_decode(@$_POST['payload'], true));
echo $result ? 'PARSED' : 'IGNORED';
}
}