diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-04-11 11:38:30 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-04-11 15:15:49 +0200 |
commit | 2c15f4003ef6caf679a014e1bbd8002e866adcf2 (patch) | |
tree | 03e0fd1cf565394d7261c055c4db945c9b41de68 /build/signed-off-checker.php | |
parent | ecc3bc64aab8c8e490492145a1c819c0e643638e (diff) | |
download | nextcloud-server-2c15f4003ef6caf679a014e1bbd8002e866adcf2.tar.gz nextcloud-server-2c15f4003ef6caf679a014e1bbd8002e866adcf2.zip |
Add auth token to github requests
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'build/signed-off-checker.php')
-rw-r--r-- | build/signed-off-checker.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/build/signed-off-checker.php b/build/signed-off-checker.php index 49890cb0f3d..f21854a83d1 100644 --- a/build/signed-off-checker.php +++ b/build/signed-off-checker.php @@ -31,6 +31,7 @@ $pullRequestNumber = getenv('DRONE_PULL_REQUEST'); $repoOwner = getenv('DRONE_REPO_OWNER'); $repoName = getenv('DRONE_REPO_NAME'); $droneEvent = getenv('DRONE_BUILD_EVENT'); +$githubToken = getenv('GITHUB_TOKEN'); if(is_string($droneEvent) && $droneEvent === 'push') { echo("Push event - no signed-off check required.\n"); @@ -52,10 +53,16 @@ if(!is_string($repoName) || $repoName === '') { exit(1); } +if(!is_string($githubToken) || $githubToken === '') { + echo("The environment variable GITHUB_TOKEN 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/'.$repoOwner.'/'.$repoName.'/pulls/'.$pullRequestNumber.'/commits'); curl_setopt($ch, CURLOPT_USERAGENT, 'CI for Nextcloud (https://github.com/nextcloud/server)'); +curl_setopt($ch, CURLOPT_HTTPHEADER, 'Authorization: token ' . $githubToken); $response = curl_exec($ch); curl_close($ch); |