Adding Github statuses integration

This commit is contained in:
Dan Cryer 2013-05-14 17:49:39 +01:00
commit 918b4deff4
4 changed files with 9 additions and 6 deletions

View file

@ -40,7 +40,7 @@ class Build extends BuildBase
if($project->getType() == 'github' && $project->getToken())
{
$url = 'https://api.github.com/repos/'.$project->getReference().'/statuses/'.$this->build->getCommitId() . '?access_token=' . $project->getToken();
$url = 'https://api.github.com/repos/'.$project->getReference().'/statuses/'.$this->getCommitId();
$http = new \b8\HttpClient();
switch($this->getStatus())
@ -63,8 +63,11 @@ class Build extends BuildBase
break;
}
$params = array('status' => $status, 'target_url' => \b8\Registry::getInstance()->get('install_url') . '/build/view/' . $this->getId());
$http->post($url, $params);
$params = array( 'state' => $status,
'target_url' => \b8\Registry::getInstance()->get('install_url') . '/build/view/' . $this->getId());
$http->setHeaders(array('Authorization: token ' . $project->getToken()));
$http->request('POST', $url, json_encode($params));
}
}
}