<?php /** * RemoteCS - Convenient Remote Coding Standards Validation * This file should be called via HTTP from GitHub as a Webhook * Make sure the script has rights to run Git * * @author Tamas Kalman <*****@*****.**> */ require_once 'vendor/autoload.php'; require_once 'Payload.class.php'; require_once 'config.php'; $payload = new Payload(); $payload->log(); $result = $payload->downloadRepository(); if (!$result) { $payload->debugLog('Cannot run Git'); exit; } $problems = $payload->validateCommits(); $payload->removeSourceDir(); if ($problems !== true) { $payload->sendEmail($problems); $payload->debugLog($problems, 'problems-'); }
#!/usr/bin/php <?php /** * GitHub Command Line Payload tester * Outputs a Payload log file in human readable format * * @author Tamas Kalman <*****@*****.**> */ require_once 'vendor/autoload.php'; require_once 'Payload.class.php'; require_once 'config.php'; $filename = isset($argv[1]) ? $argv[1] : null; if (!$filename) { printf("Usage: %s <logfile>\n", basename(__FILE__)); exit; } $payload = new Payload(); $result = $payload->loadPayloadFromLog($filename); if ($result === false) { printf("Can't load logfile: [%s]\n", $filename); exit; } $payload->downloadRepository(); $problems = $payload->validateCommits(); $payload->removeSourceDir(); if ($problems !== true) { $payload->sendEmail($problems); }