Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Since using PHP, a git push error does not produce the run to fail #17

Open
leoloso opened this issue Jul 3, 2021 · 2 comments · May be fixed by #48
Open

Since using PHP, a git push error does not produce the run to fail #17

leoloso opened this issue Jul 3, 2021 · 2 comments · May be fixed by #48

Comments

@leoloso
Copy link

leoloso commented Jul 3, 2021

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?

@TomasVotruba
Copy link
Collaborator

Go for it!

@gam6itko
Copy link

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.

@gam6itko gam6itko linked a pull request May 5, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants