GitHub Actions Tutorial — Expressions

1 minute read

Chapter 7 — Expressions & Contexts

Expressions are the programming language of GitHub Actions. Written inside ${{ }}, they let you access context data, evaluate conditions, manipulate strings, and control workflow logic — all without writing a single line of shell script.

In this chapter, you’ll learn expression syntax, the context objects that power them, conditional execution, and built-in functions.


What You’ll Learn

  • Expression syntax and operators
  • Context objects: github, env, secrets, needs, steps, matrix, runner
  • Conditional execution with if:
  • Status check functions: success(), failure(), always(), cancelled()
  • String and type functions

Topics Covered

1. Expression Syntax

Operators, literals, type coercion, and how expressions are evaluated.

Read: Expression Syntax →


2. Contexts

The data objects available inside expressions — github, env, steps, needs, matrix, and more.

Read: Contexts →


3. Conditionals

Control which steps and jobs run with if: expressions.

Read: Conditionals →


4. Status Functions

React to job and step outcomes with success(), failure(), always(), and cancelled().

Read: Status Functions →


5. String Functions

Manipulate strings with contains(), startsWith(), endsWith(), format(), and more.

Read: String Functions →


Practice

Test your understanding with hands-on exercises.

Practice Exercises →


← Previous: Chapter 6: Environment & Secrets

Next: Chapter 8: Artifacts & Caching →

Updated: