Is there a way to conditionally run steps that simulates an if-else logic without having to repeat the same “when” statement twice?
I am trying to execute workflow A if condition is met, or workflow B if not.
In this example, I am echoing different things based on the parameter passed. I am pretty much duplicating the same statement, and am wondering if it is possible for there to be an “else”?
commands:
did_win:
parameters:
win:
default: True
type: boolean
steps:
- when:
condition:
and:
- equal: [ True, << parameters.win >> ]
steps:
- run: echo "you won!"
- when:
condition:
and:
- not: [ True, <<parameters.win>> ]
steps:
- run: echo "you lost"
Maybe there’s a
- when:
condition:
and:
- equal: [ True, << parameters.win >> ]
steps:
- run: echo "you won!"
else:
- run: echo "you lost!"