summaryrefslogtreecommitdiffstats
path: root/build/signed-off-checker.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-09-22 11:40:00 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-22 11:40:00 +0200
commit0e74aaefe7815820178c5957e71ef5d752d8d83d (patch)
tree945fe93c35b1f58d51061be3f06769b0387aaf6f /build/signed-off-checker.php
parent538fcf3d1fe6499d4a1366339babc8d788c2631f (diff)
downloadnextcloud-server-0e74aaefe7815820178c5957e71ef5d752d8d83d.tar.gz
nextcloud-server-0e74aaefe7815820178c5957e71ef5d752d8d83d.zip
Rely solely on GitHub API output
This doesn't download the whole git repository again which saves roughly 90 seconds in execution time on the test. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'build/signed-off-checker.php')
-rw-r--r--build/signed-off-checker.php29
1 files changed, 7 insertions, 22 deletions
diff --git a/build/signed-off-checker.php b/build/signed-off-checker.php
index d97f4cf48b7..2a9df75b45c 100644
--- a/build/signed-off-checker.php
+++ b/build/signed-off-checker.php
@@ -41,14 +41,6 @@ curl_setopt($ch, CURLOPT_USERAGENT, 'CI for Nextcloud (https://github.com/nextcl
$response = curl_exec($ch);
curl_close($ch);
-shell_exec(
- sprintf(
- 'cd %s && git fetch',
- escapeshellarg($baseDir),
- escapeshellarg($pullRequestNumber)
- )
-);
-
$decodedResponse = json_decode($response, true);
if(!is_array($decodedResponse) || count($decodedResponse) === 0) {
echo("Could not decode JSON response from GitHub API.\n");
@@ -63,33 +55,26 @@ foreach($decodedResponse as $commit) {
echo("No SHA specified in $commit\n");
exit(1);
}
- $commits[] = $commit['sha'];
+ if(!isset($commit['commit']['message'])) {
+ echo("No commit message specified in $commit\n");
+ exit(1);
+ }
+ $commits[$commit['sha']] = $commit['commit']['message'];
}
-
if(count($commits) < 1) {
echo("Could not read commits.\n");
exit(1);
}
$notSignedCommits = [];
-foreach($commits as $commit) {
+foreach($commits as $commit => $message) {
if($commit === '') {
continue;
}
$signOffMessage = false;
- $commitMessageLines =
- explode(
- "\n",
- shell_exec(
- sprintf(
- 'cd %s && git rev-list --format=%%B --max-count=1 %s',
- $baseDir,
- $commit
- )
- )
- );
+ $commitMessageLines = explode("\n", $message);
foreach($commitMessageLines as $line) {
if(preg_match('/^Signed-off-by: .* <.*@.*>$/', $line)) {