Pre-Conditions
Skip a step if a condition is false.Common Conditions
Condition Functions
| Function | Description |
|---|---|
fileExists(path) | True if file exists |
fileLength(path) | Number of non-empty lines |
dirLength(path) | Number of directory entries |
isEmpty(str) | True if string is empty |
contains(str, substr) | True if string contains substring |
Step Dependencies (DAG Execution)
Steps can declare dependencies on other steps using thedepends_on field. This enables:
- Parallel execution of independent steps
- Automatic ordering based on dependencies
- DAG (Directed Acyclic Graph) execution
Basic Dependencies
subfinderandamassrun in parallel (no dependencies)merge-resultswaits for both to complete before executing
DAG Execution
The executor builds a dependency graph and uses topological sorting (Kahn’s algorithm) to determine execution order:Multiple Dependencies
Cascade Failure
If a dependency fails:- The dependent step is marked as failed (not executed)
- All downstream steps are also marked as failed
- Independent branches continue execution
Dependencies vs Sequential Execution
Withoutdepends_on, steps execute sequentially in order:
depends_on, steps can run in parallel:
Linter Validation
The workflow linter validates dependencies:| Rule | Description |
|---|---|
invalid-depends-on | Dependency references non-existent step |
circular-dependency | Circular dependencies detected |
Flow Module Dependencies
Flows also supportdepends_on for modules:
Decision Routing
Route to different steps based on variable values using switch/case syntax.Decision Syntax
switch: Template variable evaluated at runtime (exact string match)cases: Map of string values to goto targetsdefault: Fallback when no case matches (optional)goto: Target step name or_endto terminate
Special Goto Targets
| Target | Description |
|---|---|
_end | End workflow immediately |
step-name | Jump to named step |
Success Handlers
Execute actions when a step succeeds.Available Actions
| Action | Description | Parameters |
|---|---|---|
log | Log a message | message |
export | Export a value | key, value |
run | Run a command | command |
notify | Send notification | message |
continue | Continue execution | - |
Error Handlers
Handle step failures.Error Action Types
| Action | Description |
|---|---|
log | Log error message |
abort | Stop workflow (default) |
continue | Continue to next step |
run | Run recovery command |
notify | Send error notification |
Combined Example
Flow-Level Conditions
Conditional module execution in flows:Branching Patterns
If-Then-Else
Early Exit
Loop with Retry
Best Practices
-
Always check file existence before processing
-
Use meaningful log messages
-
Handle errors gracefully
-
Use decision routing for complex logic
-
End workflows cleanly
Next Steps
- Step Types - All step types
- Variables - Exports and conditions
- Functions Reference - Condition functions