balupton
balupton

Reputation: 48650

How to get travis to rebuild a branch via an API call?

I have a repository (called A) that utilises another repository (called B), when I push to repo A, repo A rebuilds on Travis. I would also like that when Repo B is pushed to, it triggers a webhook to travis that rebuilds Repo A on travis.

Using Circle CI, it is as easy as adding this webhook on Repo B:

https://circleci.com/api/v1/project/me/myrepoA/tree/master?circle-token=token

However I can't find an equivalent for Travis CI.

Upvotes: 2

Views: 1445

Answers (1)

Peter
Peter

Reputation: 89

Travis instructions here http://docs.travis-ci.com/user/triggering-builds/

curl example:

curl -X POST \
-H "Content-Type: application/json" \
-H "Travis-API-Version: 3" \
-H "Accept: application/json" \
-H "Authorization: token xxxxxx" \
-d '{"request": {"branch": "master"}}' 'https://api.travis-ci.org/repo/balupton%2FmyrepoA/requests'

To make the {slug|id} we need to put %2Fbetween the user and repo

Example: twbs%2Fbootstrap

Upvotes: 2

Related Questions