This commit is contained in:
Lucas Gois 2015-11-26 13:39:34 +00:00
commit be48b470a4

View file

@ -293,15 +293,18 @@ class WebhookController extends \b8\Controller
// build on merge request events
if (isset($payload['object_kind']) && $payload['object_kind'] == 'merge_request') {
$attributes = $payload['object_attributes'];
if ($attributes['state'] == 'opened' || $attributes['state'] == 'reopened') {
$branch = $attributes['source_branch'];
$commit = $attributes['last_commit'];
$committer = $commit['author']['email'];
$commit = isset($attributes['last_commit']) ? $attributes['last_commit'] : null;
$committer = isset($commit['author']['email']) ? $commit['author']['email'] : null;
$message = isset($commit['message']) ? $commit['message'] : null;
return $this->createBuild($project, $commit['id'], $branch, $committer, $commit['message']);
return $this->createBuild($project, $commit['id'], $branch, $committer, $message);
}
}
// build on push events
if (isset($payload['commits']) && is_array($payload['commits'])) {
// If we have a list of commits, then add them all as builds to be tested: