Last active
March 23, 2016 18:24
-
-
Save mrmanc/c1ff6466dc8403c4561a to your computer and use it in GitHub Desktop.
Very rudimentary script to convert the payload of a generic GitHub push event webhook to port 5637 into an API call to notify a Go CD material of an update. Not production ready… intended to be used as a test. You will need to set up a .netrc file in the home directory of the user running the script. https://curl.haxx.se/docs/manpage.html#-n
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true; do | |
echo -e 'HTTP/1.1 200 OK\r\n' | nc -d -l 5637 | grep git_url | sed -e "s/^.*\(git:\/\/[^\"]*\)\".*$/\1/" | xargs -I {} curl -s --netrc 'https://go.atcloud.io/go/api/material/notify/git' -X POST -d "repository_url={}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment