Since using PHP, a `git push` error does not produce the run to fail
I had set-up the wrong credentials in ACCESS_TOKEN. With version 1.1 when doing git push, it printed the Git error, and the process failed.
With this new version in PHP, doing exec('git push --quiet origin ' . $config->getBranch()); also produces a Git error, but it is just printed on screen; the GitHub Action does not fail, so I get the ✔️ at the end of the run.
To fix it, something like this could work:
$output = [];
$result_code = 0;
$result = $exec('git push --quiet origin ' . $config->getBranch(), $output, $result_code);
if ($result === false) {
die('Command failed: ' . implode(PHP_EOL, $output));
}
Or return $result_code?
Go for it!
from https://www.php.net/manual/ru/function.die.php
Beware that when using PHP on the command line, die("Error") simply prints "Error" to STDOUT and terminates the program with a normal exit code of 0.