Skip to content

Instantly share code, notes, and snippets.

@JoshuaTheMiller
Last active January 11, 2018 19:37
Show Gist options
  • Select an option

  • Save JoshuaTheMiller/d8608fa7e416126174ca82dd3a021aad to your computer and use it in GitHub Desktop.

Select an option

Save JoshuaTheMiller/d8608fa7e416126174ca82dd3a021aad to your computer and use it in GitHub Desktop.
A shell script for kicking off Travis-CI builds. Requires 3 environment vars to be set.
#!/bin/bash
# Requires 3 env vars to be set:
# ACCESS_TOKEN - your Travis-CI auth token. https://medium.com/@aflyingcaveman/retrieving-your-travis-ci-api-access-token-bc706b2b625a
# REPO_TO_KICK - the name of the repo to kick.
# OWNER_OF_REPO - your repo owner name.
body='{
"request":{
"branch":"master",
"message":"Build was kicked by API request"
}
}';
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${ACCESS_TOKEN}" \
-Body ${body} \
https://api.travis-ci.org/repo/${OWNER_OF_REPO}%2F${REPO_TO_KICK}/requests;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment