Simple conditional workflow (single condition)

I noticed there are options to conditionally run a workflow. However, I am having issues with a single condition. Simply put I want to run a build workflow on anything but main and a deploy workflow only on main. The below example errors out. I have also tried adding an and or an or stanza even though I have a single condition. That also errors out. Thanks for the help!

FWIW: all the examples I can find of conditional workflows all detail multiple conditions:

workflows:
  build:
    when:
      - not: [ main, << pipeline.git.branch >> ] # <- pretty sure this expression is wrong
    jobs:...

  deploy:
    when:
      - equal: [ main, << pipeline.git.branch >> ]
    jobs:...
1 Like

I think I got it, yaml syntax oops. Though it seems weird to use and on a single condition.

workflows:
  build:
    when:
      and:
        - not:
            equal: [ main, << pipeline.git.branch >> ]
    jobs:

  deploy:
    when:
      and:
        - equal: [ main, << pipeline.git.branch >> ]
    jobs:
1 Like

As stated here :

Note: When using logic statements at the workflow level, do not include the condition: key (the condition key is only needed for job level logic statements).