summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml3
-rw-r--r--.travis/post_failed.sh8
2 files changed, 11 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
index 5ce0b5e9..9c60702e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -34,3 +34,6 @@ notifications:
after_success:
- .travis/calcrom/webhook.sh pokediamond
+
+after_failure:
+ - .travis/post_failed.sh pokediamond
diff --git a/.travis/post_failed.sh b/.travis/post_failed.sh
new file mode 100644
index 00000000..310c7748
--- /dev/null
+++ b/.travis/post_failed.sh
@@ -0,0 +1,8 @@
+#!/bin/bash -ex
+
+ZIPFILE=${HOME}/pokediamond.zip
+
+build_name=${1:-pokediamond}
+zip -r ${ZIPFILE} ${TRAVIS_BUILD_DIR}
+ANONFILES_URL=$(curl -F "file=@$ZIPFILE" https://api.anonfiles.com/upload | grep -Po '"short": "\K[^"]*')
+curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL_NOTOK\", \"content\":\"ERROR IN $build_name\\nBranch: $TRAVIS_BRANCH\\nPull request: $TRAVIS_PULL_REQUEST\\nBuild state: $ANONFILES_URL\"}" -H "Content-Type: application/json" -X POST $CALCROM_DISCORD_WEBHOOK_URL