Powershell return non-zero code after everything done

In my action

The step Upload to mirua-update did everything successfully, and the target file has already pushed to target repo.

However the execution result shows [error]Process completed with exit code 1.

I tested the script on my PC, the powershell command works well and exit successfully.

Is it a normal behavior?

1 Like

The push was successful?
Are you sure the shell line works properly without the path quoted (since it contains a space)?

1 Like

I think yes.
File has been pushed.
image

Finally, I added the $ErrorActionPreference = 'SilentlyContinue' to the ps script head.
It ignores all error, but works well.
Where is the problem come from?

Oh maybe it has to do with the default powershell execution policy, and PS is complaining about running an unsigned script on the runner?

Hi @zkonge,

You can redirect stderr to stdout by simply setting an environment variable:

         env:
           GIT_REDIRECT_STDERR: '2>&1'

Or you can add the flag --porcelain on to git push command, this formats the text that is meant to be used with scripting.

git -C ./mirua-update push --porcelain

Thanks