35

I have a few branches in my repo and I have the .travis.yml file in a branch A (master branch does not have this file). But travis-CI is not starting the build for branch A. What do I need to do to run travis for this branch? When I create a Pull Request from some other branch to master, then travis starts the build.

P.S. I turned off/on Build only if .travis.yml is present but it did not help. Also I can't see any branches in Branches tab. I added

branches:
  only:
    -A
    -master

in the .travis.yml, but it too did not help.

fzk
  • 443
  • 1
  • 5
  • 12
Artur Sh
  • 351
  • 1
  • 3
  • 3

3 Answers3

36

You can try and check if it would work with a whitelist.
See "Specify branches to build"

You can either white- or blacklist branches that you want to be built:

# blacklist
branches:
  except:
    - legacy
    - experimental

# whitelist
branches:
  only:
    - master
    - stable

Try and put A in a whitelist syntax in the travis.yml, and see if that is picked-up.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
6

Your sample in .travis.yml is not yml compatible. You need put a whitespace before your branch names.

 branches:
  only:
    - A
    - master
Csaba Lép
  • 61
  • 1
  • 3
1

Apart for adding the whitelist branches,you can add a .travis.yml file to the branches of interest.

Note that for historical reasons .travis.yml needs to be present on
all active branches of your project.

You can get this from here

Granson
  • 128
  • 1
  • 4