casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
20.08k stars 449 forks source link

justfile does not preserver the command exit code #2328

Open a0m0rajab opened 2 weeks ago

a0m0rajab commented 2 weeks ago

i have the next just file, when I have an error in the dotnet build code, the build returns 1 exit code, yet just files does not return that code to use with GitHub actions in the CI/CD, how can I get the exit code from the dotnet build and use it in the action?

null:

clean:
    abp clean && dotnet clean && dotnet nuget locals all --clear

build:
    export $(grep -v '^#' .env | xargs) && dotnet build -nologo -verbosity:quiet -graph || exit $?
laniakea64 commented 2 weeks ago

On Xubuntu 22.04, with just latest master and this test justfile...

test:
    sh -c 'exit 3' || exit $?

... just does return the failure exit code -

$ just ; echo $?
sh -c 'exit 3' || exit $?
error: Recipe `test` failed on line 2 with exit code 3
3

What OS is your action running in? What shell is just using for your justfile?