Branche WhiteList and Pull requests

Hello I wonder if this is possible or what I’m missing.

I would like a build to only trigger for specific branches. I’m using travis to push a docker image, so I don’t want every developer feature branch to generate a published docker image.

I have something like this:

services:
- docker

env:
  matrix:
  - DOCKER_COMPOSE_VERSION=1.25.4
  global:
    secure: blah

jobs:
  include:
  - stage: build docker image
    script:
    - "./scripts/integration.sh"


branches:
  only:
  - 1.3.0
  - 1.4.0
  - 1.5.0
  - 1.6.0

My question is, is there a way to still have PR triggered? Right now it seems like the builds only run for those branches, how would i allow PR to also run? Ideally only PRs against those branches but that’s just nice to have. I do need PR to trigger a build.

I was looking at: https://docs.travis-ci.com/user/customizing-the-build/#building-specific-branches but I didn’t see anything on how to allow this scenario.

Any help is appreciated.

See


and

You want to come up with the if condition that meets your needs.