continue-on-error can prevent a job step failure causing an action failure

| 1 min read

Use continue-on-error: true in a GitHub Actions job spec to prevent failures from being flagged when a job step fails.

For me, high (non-zero) return codes don't always necessarily denote failure; sometimes I want to use a high return code to control step execution (see TIL: git diff can emit different exit codes). But this means that the entire workflow run is marked as failed in a GitHub Action context. To prevent this, you can use continue-on-error at the job level to prevent a workflow from failing when a job fails.

I added this to my build workflow and it works nicely. See for example action execution 178511479 - i.e. even when there was a step that ended with a high return code (deliberately, to signify no changes), the entire execution was still marked as a success:

action marked as success

(Hat tip to Tom Jung for this).