Skip to main content
This article explores how to use expressions in GitHub Actions to control the execution flow of steps and jobs. We cover:
  • 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.
In this example:
  • Ubuntu tests pass.
  • Windows commands fail on Linux, causing the testing job to abort.
  • As a result, reports and deploy are 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:
Each step only executes on its intended OS, preventing unsupported commands from running.

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.
Here, even though the upload step fails, reports completes successfully and triggers the deploy job.

Status Check Functions

GitHub Actions provides built-in functions to inspect previous outcomes: Example:
These functions help you create resilient, conditional workflows that adapt to your CI/CD pipeline’s status.

Watch Video