From 5f2de9a6798ffee196345da183b5f16573aab101 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Tue, 10 Mar 2015 20:20:54 +0000 Subject: [PATCH] Update to only build the latest commit from a Github pull request webhook. --- PHPCI/Controller/WebhookController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PHPCI/Controller/WebhookController.php b/PHPCI/Controller/WebhookController.php index 619eec16..7e38d60a 100644 --- a/PHPCI/Controller/WebhookController.php +++ b/PHPCI/Controller/WebhookController.php @@ -232,6 +232,11 @@ class WebhookController extends \PHPCI\Controller } foreach ($response['body'] as $commit) { + // Skip all but the current HEAD commit ID: + if ($commit['sha'] != $payload['head']['sha']) { + continue; + } + $branch = str_replace('refs/heads/', '', $payload['pull_request']['base']['ref']); $committer = $commit['commit']['author']['email']; $message = $commit['commit']['message'];