$message) { if ($commit === '') { continue; } $signOffMessage = false; $commitMessageLines = explode("\n", $message); foreach ($commitMessageLines as $line) { if (preg_match('/^Signed-off-by: .* <.*@.*>$/', $line)) { echo "$commit is signed-off with \"$line\"\n"; $signOffMessage = true; continue; } } if ($signOffMessage === true) { continue; } $notSignedCommits[] = $commit; } if ($notSignedCommits !== []) { echo("\n"); echo("Some commits were not signed off!\n"); echo("Missing signatures on:\n"); foreach ($notSignedCommits as $commit) { echo("- " . $commit . "\n"); } echo("Build has failed\n"); exit(1); } else { exit(0); }