Skipping a deployment with the script provider because a custom condition was not met when using a regex

I’m having issues trying to run a conditional deployment with a regex. I want all feature/**** branches to deploy to a branch in the artifact repo. I’m able to deploy develop and master branches as expected but can’t get the feature regex to match. This is my current config

deploy:
  - provider: script
    script: ./vendor/bin/px artifact:deploy --no-interaction --no-build-version --branch=ci-raleigh-vendor
    on:
      branch: master
    skip_cleanup: true
  - provider: script
    script: ./vendor/bin/px artifact:deploy --no-interaction --no-build-version --branch=develop
    on:
      branch: develop
    skip_cleanup: true
  - provider: script
    script: ./vendor/bin/px artifact:deploy --no-interaction --no-build-version --branch=$TRAVIS_BRANCH
    on:
      all_branches: true
      condition: $TRAVIS_BRANCH =~ ^feature\/\S+$
    skip_cleanup: true

When building and deploying feature/ABC-123 I get the following results in the log

Skipping a deployment with the script provider because this branch is not permitted: feature/ABC-123
Skipping a deployment with the script provider because this branch is not permitted: feature/ABC-123
Skipping a deployment with the script provider because a custom condition was not met

I would expect the first two to skip, but the last one is not meeting the condition. I’ve run the build in debug mode, installed travis-conditions and was able to test my regex which evaluated to true as expected.

travis-conditions eval "branch =~ ^feature\/\S+$" --data '{"branch": "feature/ABC-123"}'
true

Not sure what else may be happening.

[quote=“pixelwhip, post:1, topic:11094”]

Setting edge: true and making the regex a little more broad seems to have fixed the issue.

deploy:
...
  - provider: script
    edge: true
    script: ./vendor/bin/px artifact:deploy --no-interaction --no-build-version --branch=$TRAVIS_BRANCH
    on:
      all_branches: true
      condition: $TRAVIS_BRANCH =~ ^feature\/.+$
    cleanup: false

on: condition: is a Bash conditional expression, unlike if: conditions.

Bash’s =~ operator uses Extended Regex rather than PCRE.

condition: $TRAVIS_BRANCH =~ ^feature/[^[:space:]]+$