Github action step hanging

Hi, i created a github action with single job only, that job contains multiple steps, but due to error in step it hanging untill timeout
Can i catch that error to exit that step and proceed to next step or can i access exit code of last run command in run step and then exit that step ?

This is the error occured in step and then it start hanging

Error occured while creating tests { status: 500, value: { message: Error occured while batching the tests {"message":"There're 2 active tunnels, please provide a tunnel identifier"} } }

The runner can’t detect if a running process is working as expected or hanging, you need to look at whatever runs in the step to fix it (and “crash instead of hang” would be a fix, then the runner would notice). If you’d like help with that, please post a link to an affected workflow run, or at least the relevant code.

To limit the impact meanwhile you can reduce timeout-minutes for the step, so a hanging process is canceled earlier.

Hi please check this url testing-5 · FoodSafetyAPP/react-cypress-lambdatest@fcdc7a0 · GitHub
For now i reduced timeout to 5 minutes and then step terminated, you can see staus 500 when you open step “Execute lambdatest cli”
I want to terminate step via programatically, not via timeout
I check in documentation of github actions and by default bash shell using
“* Fail-fast behavior using set -eo pipefail : Default for bash and built-in shell . It is also the default when you don’t provide an option on non-Windows platforms.”
So i’m expecting if there any error in step then it will terminate automatically, but it will not doing like that
You can check my workflow using this url
react-cypress-lambdatest/cypress-lambdatest.yml at fcdc7a0f5b81ba8ac386280c8e20002623f6237f · FoodSafetyAPP/react-cypress-lambdatest · GitHub

It should terminate as failed as soon as one of the commands specified in the run step terminates with a non-zero exit code. The step you linked has exactly one npm command, so you’ll need to make sure that terminates. Error conditions within a command that don’t make it terminate won’t end the step.

yeah i can understand this. But can i access exit code of run command and then terminate that step manually OR i can catch error using error handling methods if any in github actions ?

A run step on Linux runs in Bash, you can use the regular Bash mechanisms to handle commands and their exit codes however you want. Just mind that by default that Bash runs with set -e, so it will terminate on the first non-zero exit code that isn’t handled. “Handling” means e.g. using the command as an if condition:

if your-command; then
    echo "command succeeded"
    echo "command failed"