Closed ksassnowski closed 2 years ago
Nice! What about the dependencies?
The callback gets passed the whole WorkflowDefinition
object. So you can add dependencies just like you normally would.
I've updated the PR to use the Conditionable
trait instead. I also decided to remove the test cases as these would just be testing the trait.
This PR adds a
when
method to theWorkflowDefinition
class to conditionally run a callback when configuring a definition. This allows users to conditionally add jobs to a workflow without having to litter definition with tons of if-statements.This has been previously suggested in #2 where I initially declined the proposal. I have since then changed my mind on this and agree that this would be a useful addition. The method's API works slightly different than in the original PR but is otherwise pretty similar.
@morrislaptop I will add you as a co-author on this feature since you were the one who originally proposed it.
Usage