Removed Github configuration from ProjectController / ProjectForm and added it to a new settings area.

This commit is contained in:
Dan Cryer 2013-10-11 21:51:23 +01:00
commit 2a47b08fec
10 changed files with 332 additions and 88 deletions

View file

@ -40,13 +40,14 @@ class GithubBuild extends RemoteGitBuild
*/
public function sendStatusPostback()
{
$project = $this->getProject();
$token = \b8\Config::getInstance()->get('phpci.github.token');
// The postback will only work if we have an access token.
if (!$project->getToken()) {
if (empty($token)) {
return;
}
$project = $this->getProject();
$url = 'https://api.github.com/repos/'.$project->getReference().'/statuses/'.$this->getCommitId();
$http = new \b8\HttpClient();
@ -71,7 +72,7 @@ class GithubBuild extends RemoteGitBuild
$params = array( 'state' => $status,
'target_url' => $phpciUrl . '/build/view/' . $this->getId());
$headers = array(
'Authorization: token ' . $project->getToken(),
'Authorization: token ' . $token,
'Content-Type: application/x-www-form-urlencoded'
);