diff --git a/.gitignore b/.gitignore index 7a3a405..aca29df 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ deploy.php +deploy.log +/.idea/* diff --git a/deploy.sample.php b/deploy.sample.php index 70b477e..966a905 100644 --- a/deploy.sample.php +++ b/deploy.sample.php @@ -1,10 +1,12 @@ &1", $output, $exit); + $json["ref"]= reset($output); + } + // check if pushed branch matches branch specified in config if ($json["ref"] === BRANCH) { fputs($file, $content . PHP_EOL); // ensure directory is a repository - if (file_exists($DIR . ".git") && is_dir($DIR)) { + if (file_exists($DIR . "\.git") && is_dir($DIR)) { // change directory to the repository chdir($DIR); @@ -139,7 +145,7 @@ function forbid($file, $reason) { // if an error occurred, return 500 and log the error if ($exit !== 0) { http_response_code(500); - $output = "=== ERROR: Pull failed using GIT `" . GIT . "` and DIR `" . DIR . "` ===\n" . $output; + $output = "=== ERROR: Pull failed using GIT `" . GIT . "` and DIR `" . $DIR . "` ===\n" . $output; } // write the output to the log and the body