1
0
Fork 0

Generate private zipball urls for private repositories

pull/1392/head
Chris Smith 2012-11-28 17:17:32 +00:00 committed by Jordi Boggiano
parent 1ce7c28f11
commit 120f52c632
1 changed files with 8 additions and 1 deletions

View File

@ -108,7 +108,14 @@ class GitHubDriver extends VcsDriver
return $this->gitDriver->getDist($identifier);
}
$label = array_search($identifier, $this->getTags()) ?: $identifier;
$url = 'https://github.com/'.$this->owner.'/'.$this->repository.'/archive/'.$label.'.zip';
if ($this->isPrivate) {
// Private GitHub repository zipballs are accessed through the API.
// http://developer.github.com/v3/repos/contents/#get-archive-link
$url = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$label;
} else {
$url = 'https://github.com/'.$this->owner.'/'.$this->repository.'/archive/'.$label.'.zip';
}
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
}