Automation · Workflow Automation
Conditional Execution
Cheat sheet · https://pcornel.dk/topic.php?topic=5366
Answer
Conditional execution runs a step only when a condition is true, such as when: in Ansible or if: in GitHub Actions, skipping it otherwise.
Remember
- when: or if: decides whether a step runs.
- Skipped steps should be logged.
- Conditions use earlier outputs.
First checks
- Condition expressions — logic
- Tests for each condition — coverage
- Skipped step reporting — visibility
Verify in this order
condition true → run step; false → skip
Where it usually breaks
Commit/input → runner/job → build/test artifact → deployment request → target rollout/reconcile → effective version/config → health/readiness → workload.
Workflow Automation → Conditional Execution · operational reference
| Layer | Workflow Automation → Conditional Execution operational reference |
|---|---|
| Runtime/ownership | workflow conditional execution patterns · the workflow engine evaluating a condition in the context of a specific run/job/step and available status/data values |
| Persistent intent | versioned condition expression with explicit inputs, null/default semantics and the side-effecting step/job it gates |
| Verification | Execute fixtures that make the condition true, false and missing/invalid; capture the evaluated context and confirm the protected action runs only for the intended case. |
| Expected interpretation | The workflow marks skipped versus executed actions distinctly, the expression result is reproducible from recorded inputs, and only the true path can mutate the target. |
| Recovery boundary | retain evaluated inputs and expression result, fix the condition/context rather than forcing the step, rerun the same fixture and verify both execute and skip paths |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5366