Stopping Travis from building on main branch, during pull request

thetravis.yml I have for the company I work accounts for running the “publish” stage only on the main branch. here’s the way i’m handling it (we are paying customer):

stages:
  - build
  - test
  - name: publish
    if: branch = main
  - release

there is some PR about this already, any help much appreciated @montana?

Hey,

I see the problem within the first 30 seconds of looking at this .travis.yml config, do this instead:

stages:
  - build
  - test
  - name: publish
    if: branch = main AND type NOT IN (pull_request)
  - release

You need to add main AND type NOT IN then call pull_request. Problem fixed.

Montana Mendy
Travis CI Staff
Happy Building!

1 Like