Skip to content

if-equal

if-equal - compare two values for equality

state-name:
tool: if-equal
arguments:
left: <value1>
right: <value2>
goto:
true: <equal-state>
false: <not-equal-state>

The if-equal tool performs a case-sensitive string comparison between two values. It returns "true" if the values are equal, or "false" if they differ.

Both values are trimmed of leading/trailing whitespace before comparison. This handles common issues with captured outputs that include trailing newlines.

ArgumentRequiredDefaultDescription
leftYes-First value to compare
rightYes-Second value to compare
CodeMeaning
0Success (outputs “true” or “false”)
1Missing required argument

The tool outputs "true" if the trimmed values are equal, or "false" if they differ.

check-status:
tool: if-equal
arguments:
left: "{{ status }}"
right: "ready"
goto:
true: proceed
false: wait-for-ready
compare-values:
tool: if-equal
arguments:
left: "{{ old_hash }}"
right: "{{ new_hash }}"
goto:
true: no-changes
false: has-changes
check-env:
tool: if-equal
arguments:
left: "{{ environment }}"
right: "production"
goto:
true: production-deploy
false: staging-deploy
ask-confirmation:
tool: ask-user
arguments:
question: "Continue with deployment?"
options:
- "yes"
- "no"
output: var(confirm)
next: check-confirm
check-confirm:
tool: if-equal
arguments:
left: "{{ confirm }}"
right: "yes"
goto:
true: deploy
false: cancel
run-tests:
tool: bash
arguments:
command: npm test && echo "passed" || echo "failed"
output: var(test_result)
next: check-tests
check-tests:
tool: if-equal
arguments:
left: "{{ test_result }}"
right: "passed"
goto:
true: tests-passed
false: tests-failed
  • Case-sensitive: "Hello" and "hello" are NOT equal
  • Whitespace-trimmed: " value " and "value" ARE equal
  • Type coercion: Non-string values are converted to strings before comparison
  • Null handling: Null values are converted to empty strings
is-enabled:
tool: if-equal
arguments:
left: "{{ feature_flag }}"
right: "true"
goto:
true: feature-enabled
false: feature-disabled
check-response:
tool: bash
arguments:
command: curl -s -o /dev/null -w "%{http_code}" https://api.example.com/health
output: var(status_code)
next: verify-status
verify-status:
tool: if-equal
arguments:
left: "{{ status_code }}"
right: "200"
goto:
true: healthy
false: unhealthy