Using TRAVIS_COMMIT_RANGE for a conditional stage prevents stage from ever running


#1

I have a second stage that I would like to run on some of my builds, after the default test stage. The script for this stage requires the commit range for the PR. As such, I have the stage configured to be conditional on the presence of the TRAVIS_COMMIT_RANGE env var.

jobs:
  include:
    - stage: test
    - stage: verify definitions
      if: env(TRAVIS_COMMIT_RANGE) is present
      script: npm run verify-definitions -- $TRAVIS_COMMIT_RANGE

When my travis.yml is configured as above, the verification stage _never gets triggered.

When I remove the conditional, then the stage runs as expected (it runs successfully on PR builds, but fails as expected on push builds because the push build doesn’t have the requisite TRAVIS_COMMIT_RANGE env var).

Why is this conditional never evaluating to true and forcing the verification stage to run on PR builds?