Skip to content

Instantly share code, notes, and snippets.

@chrisdickinson
Created March 10, 2013 07:36
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 chrisdickinson/5127523 to your computer and use it in GitHub Desktop.
Save chrisdickinson/5127523 to your computer and use it in GitHub Desktop.
add testling ci hooks
#!/bin/bash
url=$(git remote -v | grep origin | head -n 1 | awk '{print $2}')
path=$(node -e 'var url = require("url"), _ = "'$url'"; if(_.indexOf("://") === -1) { _ = _.replace(":", "/"); _ = "ssh://"+_; }; _ = url.parse(_);console.log(_.pathname.replace(/\.git$/, "").slice(1));')
curl -X POST -H "Authorization: Token $(cat ~/.github-token)" -d '{"name":"web", "config":{"url": "http://git.testling.com/", "content_type": "form"}}' https://api.github.com/repos/$path/hooks 2>/dev/null 1>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment