Conditional import not working

I am trying to run a different build depending on whether the job is a cron job or not. My .travis.yml is as follows:

version: ~> 1.0

- source: ci/travis_cron.yml
  if: env(TRAVIS_EVENT_TYPE) = cron
- source: ci/travis_default.yml
  if: env(TRAVIS_EVENT_TYPE) != cron

Unfortunately this always imports the second file (ci/travis_default.yml), even for cron jobs. Does anybody know what I am doing wrong here?

EDIT: I found a way to make it work by using type instead of env(TRAVIS_EVENT_TYPE). The question remains though, why does the .travis.yml file above not work?

TRAVIS_EVENT_TYPE is an environment variable defined at run time, so you can’t use it as an argument to the env() function. In other words, env(TRAVIS_EVENT_TYPE) is "", the second (and only the second) import is always effective.

This is noted in

which is mentioned at the end of