Stages conditions not evaluating as expected

I see there are similar posts from last year, but I want to check that this is a bug (still) and not my error.

These are the build attributes:

TRAVIS_REPO_SLUG = my-name/my-repo
TRAVIS_EVENT_TYPE = pull_request
TRAVIS_BRANCH = master

The following stage runs (as expected):

- stage: deploy
      if: ((repo = my-name/my-repo) AND (branch = master)) OR ((repo != my-name/my-repo) AND (branch != master))
      script:
        - echo "deploy stage started"

but the following condition ALSO runs, which it should not:

- stage: deploy
      if: ((repo = my-name/my-repo) AND (branch = master)) OR ((repo != my-name/my-repo) AND (branch != master)) AND type = push
      script:
        - echo "deploy stage started"

This does NOT run, which is expected:

- stage: deploy
      if: type = push
      script:
        - echo "deploy stage started"

This does NOT run, which is expected:

- stage: deploy
      if: (repo != my-name/my-repo) AND (branch != some-branch)
      script:
        - echo "deploy stage started"

So the last AND condition in the second example isn’t working. Thoughts?

Thanks!

Hello @mistercoffee66,

Can I see your whole .travis.yml in aggregate? This might be a bit more helpful for me.

Hi @Montana , thanks for your reply. I added some additional parens around my conditions and all is now well. Cheers!

Hey @mistercoffee66,

That’s great to hear!