Check condition in action

Is it possible to check a condition and then continue or not the action?
Something like:

automation:
trigger: …
condition 1
action:
- a1
- a2

  • condition 2
    • a3

I would like to continue only in some specific cases with action 3. Now I am using scripts for this.
Thank you