3

I can't find how to enable a repository to build in Travis CI through the API in the docs. It seems flicking the switch is a manual step, is that correct?

Specifically can we flick the switch shown in the image below programmatically? enter image description here

quine
  • 982
  • 1
  • 12
  • 20
ChucK
  • 2,114
  • 1
  • 18
  • 20

1 Answers1

4

The end-point for this is kind of misleading and also it takes more than one step to achieve this:

  1. Force a synchronization just to make sure the repo will be there

  2. Obtain the repository ID (yes, you must have it)

  3. Flick the switch

If you are working with Python you can use TravisPy to achieve this.

from travispy import TravisPy

travis = TravisPy.github_auth('github token')
repo = travis.repo('menegazzo/travispy')
repo.enable() # Switch is now on
repo.disable() # Switch is now off
Fabio Menegazzo
  • 1,191
  • 8
  • 9