Generate private zipball urls for private repositories

main
Chris Smith 12 years ago committed by Jordi Boggiano
parent 1ce7c28f11
commit 120f52c632

@ -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' => '');
}

Loading…
Cancel
Save