Add post_failed.sh webhook

This commit is contained in:
PikalaxALT
2020-06-18 16:36:46 -04:00
parent bc811daa7c
commit 1842d02112
2 changed files with 11 additions and 0 deletions

View File

@@ -34,3 +34,6 @@ notifications:
after_success:
- .travis/calcrom/webhook.sh pokediamond
after_failure:
- .travis/post_failed.sh pokediamond

8
.travis/post_failed.sh Normal file
View File

@@ -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