if conditional
The if key on a job or step that runs it only when an expression is true.
In more detail
Functions such as always(), success() and failure() look at earlier results, so if: always() uploads a test report even after the tests failed. A matrix property can be tested the same way, as in if: matrix.coverage.
Example
if: always()Related terms
- workflow expression — Text inside ${{ and }} in a workflow file that GitHub evaluates before a step runs, such as ${{ github.sha }}.
- test report — A file written by a test run that records which tests passed and failed.
Taught in
- Passing Data Between Jobs: Artifacts — Continuous Integration & Continuous Delivery Pipelines
- Scaling with Matrix Builds — Continuous Integration & Continuous Delivery Pipelines
- Expressions, Contexts And The If That Is Always True — GitHub Actions (GH-200) Exam Prep
- Matrices, Needs And Concurrency: The Shape Of A Run — GitHub Actions (GH-200) Exam Prep
- Why It Ran, Why It Did Not: Reading Runs, Jobs And Checks — GitHub Actions (GH-200) Exam Prep
- Three Kinds Of Action: JavaScript, Docker Container Or Composite — GitHub Actions (GH-200) Exam Prep
- Secrets And Variables By Scope: Precedence, Access And The REST API — GitHub Actions (GH-200) Exam Prep
- YAML-Reading Sprint: What Happens When This Runs? — GitHub Actions (GH-200) Exam Prep
References
- GitHub Docs: Evaluate expressions in workflows and actions
- GitHub Docs: Workflow syntax for GitHub Actions