- Conditional execution with
if - Ignoring failures using
continue-on-error - Built-in status check functions
Sample Workflow
The following workflow runs tests on both Ubuntu and Windows, uploads a report to AWS S3 (failing intentionally), and then deploys if the report step completes.- Ubuntu tests pass.
- Windows commands fail on Linux, causing the
testingjob to abort. - As a result,
reportsanddeployare skipped.
Conditional Execution with if
Use if to run steps or jobs only when a condition is met. You can reference contexts like runner.os, literals, and functions:
Ignoring Failures with continue-on-error
By default, a failed step aborts its job. To let a job succeed even if a step fails, set continue-on-error: true. Downstream jobs defined with needs will still run if the parent job completes.
The
continue-on-error attribute applies at the step level, not at the job level.reports completes successfully and triggers the deploy job.
Status Check Functions
GitHub Actions provides built-in functions to inspect previous outcomes:
Example: