2

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.

balupton
  • 47,113
  • 32
  • 131
  • 182
  • http://stackoverflow.com/q/17606874/130638 is a similar question, but none of the answers there are about an API call to do this - need an API call for this, as must be accomplished via GitHub Webhook. – balupton Aug 24 '15 at 09:54
  • For those interested, I came up with this https://gist.githubusercontent.com/balupton/a10abaf708c835eed154/raw/travisci-other.yml from https://gist.github.com/balupton/a10abaf708c835eed154 to workaround not having easy access to the API. – balupton Aug 26 '15 at 07:58

1 Answers1

2

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

Peter
  • 91
  • 1
  • 3
  • Sweet! Any idea what the values would be for the GitHub Webhook fields? Or at this point, is it not GitHub Webhook compatible? – balupton Aug 24 '15 at 23:57
  • so how to find status of that request later? I have this question open https://stackoverflow.com/questions/44569955/check-status-of-job-requested-through-ravis-api-v3 – noonex Jun 16 '17 at 09:21