I learnt the hard way that the default shell settings for Github actions don’t catch command pipeline failures.
That is, this workflow does not fail:
--- name: Pipeline SILENT failure jobs: my-silently-failing-job: runs-on: ubuntu-latest steps: - name: Pipeline fail run: false | true
In my case, I was doing something like:
python main.py $args | tee output.txt
and didn’t realise that the Python command was crashing as the pipeline exit code was zero.
The solution is to specify
shell: bash which causes Github to run the command
set -eo pipefail and hence pipeline failures are caught.
This workflow will fail:
--- name: Pipeline NOISY failure jobs: my-failing-job: runs-on: ubuntu-latest steps: - name: Pipeline fail shell: bash run: false | true