What's the best practice for making a workflow step conditional? Like, can I do the following to sk

What's the best practice for making a workflow step conditional?

Like, can I do the following to skip a step entirely?
const shouldHappen = await step.do('check condition', async () => { return false })
if (shouldHappen) {
  await step.do('conditional step', async () => { //do something })
}


Or, should I evaluate the condition within a step, like this?
const shouldHappen = await step.do('check condition', async () => { return false })
await step.do('conditional step', async () => {
  if (!shouldHappen) return
  //do something
})
Was this page helpful?