Merge pull request #1530 from nextcloud/make-repo-configurable

Read repo name dynamically
This commit is contained in:
Lukas Reschke 2016-09-26 21:21:17 +02:00 committed by GitHub
commit 56437ad881

View file

@ -28,15 +28,27 @@
$baseDir = __DIR__ . '/../';
$pullRequestNumber = getenv('DRONE_PULL_REQUEST');
$repoOwner = getenv('DRONE_REPO_OWNER');
$repoName = getenv('DRONE_REPO_NAME');
if(!is_string($pullRequestNumber) || $pullRequestNumber === '') {
echo("The environment variable DRONE_PULL_REQUEST has no proper value.\n");
exit(1);
}
if(!is_string($repoOwner) || $repoOwner === '') {
echo("The environment variable DRONE_REPO_OWNER has no proper value.\n");
exit(1);
}
if(!is_string($repoName) || $repoName === '') {
echo("The environment variable DRONE_REPO_NAME has no proper value.\n");
exit(1);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://api.github.com/repos/nextcloud/server/pulls/'.$pullRequestNumber.'/commits');
curl_setopt($ch, CURLOPT_URL, 'https://api.github.com/repos/'.$repoOwner.'/'.$repoName.'/pulls/'.$pullRequestNumber.'/commits');
curl_setopt($ch, CURLOPT_USERAGENT, 'CI for Nextcloud (https://github.com/nextcloud/server)');
$response = curl_exec($ch);
curl_close($ch);