Set step as succeeded on timeout in GitHub Actions

Viewed 584

Is there a way to declare a step timeout in a GitHub Actions to be a 'successful job'? I want to build an executable and run it for a couple of minutes - if it doesn't crash, the pipeline should tell me the test passed / succeeded. It's certainly possible to use something like timeout in bash - but I'm trying to figure out a cross platform solution, hence trying to accomplish this with "pure actions".

1 Answers

Example of job succeeding on timeout.

      - name: no timeout
        run: timeout 10 python ./sleep.py || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi

See this example repo and related answer.

Related