Skip to content

Instantly share code, notes, and snippets.

@kamranayub
Created March 29, 2015 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamranayub/88f963a9ac3d5bf6114d to your computer and use it in GitHub Desktop.
Save kamranayub/88f963a9ac3d5bf6114d to your computer and use it in GitHub Desktop.
Manually trigger Travis CI build for repository
var Travis = require('travis-ci');
// change this
var repo = "kamranayub/kamranayub.github.io";
var travis = new Travis({
version: '2.0.0'
});
travis.authenticate({
// available through Travis CI
// see: http://kamranicus.com/blog/2015/02/26/continuous-deployment-with-travis-ci/
github_token: process.env.GH_TOKEN
}, function (err, res) {
if (err) {
return console.error(err);
}
travis.repos(repo.split('/')[0], repo.split('/')[1]).builds.get(function (err, res) {
if (err) {
return console.error(err);
}
travis.requests.post({
build_id: res.builds[0].id
}, function (err, res) {
if (err) {
return console.error(err);
}
console.log(res.flash[0].notice);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment