From 0bcb13af0952949a1b60106eb076d67d3e3120f1 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Mon, 24 Feb 2014 19:23:46 +0000 Subject: [PATCH] Updating Bitbucket Webhook --- PHPCI/Controller/WebhookController.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/PHPCI/Controller/WebhookController.php b/PHPCI/Controller/WebhookController.php index 2e12fc58..f99e333e 100644 --- a/PHPCI/Controller/WebhookController.php +++ b/PHPCI/Controller/WebhookController.php @@ -40,21 +40,20 @@ class WebhookController extends \PHPCI\Controller { $payload = json_decode($this->getParam('payload'), true); $branches = array(); - $commits = array(); foreach ($payload['commits'] as $commit) { - if (!in_array($commit['branch'], $branches)) { - $branches[] = $commit['branch']; - $commits[$commit['branch']] = $commit['raw_node']; + if (!in_array($commit['branch'], array_keys($commits))) { + $commits[$commit['branch']] = $commit; } } - foreach ($branches as $branch) { + foreach ($commits as $commit) { try { $build = new Build(); $build->setProjectId($project); - $build->setCommitId($commits[$branch]); + $build->setCommitId($commit['raw_node']); + $build->setCommitterEmail($commit['raw_author']); $build->setStatus(Build::STATUS_NEW); $build->setLog(''); $build->setCreated(new \DateTime());