Skip to content

Instantly share code, notes, and snippets.

@drazisil
Created November 16, 2015 23:20
Show Gist options
  • Save drazisil/bb3ee177d69487dc25c8 to your computer and use it in GitHub Desktop.
Save drazisil/bb3ee177d69487dc25c8 to your computer and use it in GitHub Desktop.
#!/bin/bash
#curl -s -k -H "Accept: application/json" "https://circleci.com/api/v1/recent-builds?circle-token=:$CIRCLE_BUILD_TOKEN&limit=1" | echo
#foo=$(($?))
WHO_BROKE_IT=$(git log HEAD^..HEAD --pretty='%aN <%aE>' | sort -u)
echo "Build Broke! (I blame $WHO_BROKE_IT)"
echo "Installing email software..."
sudo apt-get install bsd-mailx sendemail
echo "Sending email to the offending party..."
#uuencode file1.png file1.png | mail -s "Funny" users@groups.nixcraft.net.i
sendEmail -f "build status <build-status@no-reply.circleci.localhost>" -t "$WHO_BROKE_IT" -u "You Broke the build!" -m "https://circleci.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/$CIRCLE_BUILD_NUM"
echo "Exiting with failure."
exit(1)
#bar="https://circleci.com/api/v1/recent-builds?circle-token=:$CIRCLE_BUILD_TOKEN&limit=1"
#curl -s -k -H "Accept: application/json" $bar
#git log HEAD^..HEAD --pretty='%aN <%aE>' | sort -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment