summaryrefslogtreecommitdiff
path: root/.github/calcrom/webhook.sh
diff options
context:
space:
mode:
authorSeth Barberee <seth.barberee@gmail.com>2021-01-28 12:58:40 -0600
committerGitHub <noreply@github.com>2021-01-28 12:58:40 -0600
commit5f0b3f2faa137d4b31925bc30bcbabfa0af5e99e (patch)
treef5a9a73477fdf9214c1d533aa81d28815504f408 /.github/calcrom/webhook.sh
parent1d9dbf3497641cabcd93b204ed4f75204710d690 (diff)
parent96297af9cc0ece7833d2729bc0faab8a81fdaada (diff)
Merge pull request #23 from SethBarberee/github_ci
[WIP] Github Actions
Diffstat (limited to '.github/calcrom/webhook.sh')
-rwxr-xr-x.github/calcrom/webhook.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/.github/calcrom/webhook.sh b/.github/calcrom/webhook.sh
new file mode 100755
index 0000000..143476c
--- /dev/null
+++ b/.github/calcrom/webhook.sh
@@ -0,0 +1,13 @@
+#!/bin/bash -ex
+
+# the workflow will make sure this runs on a push to master only
+
+build_name=$1
+map_file=$build_name.map
+if [ ! -f $map_file ]; then
+ echo "$map_file does not exist!"
+ exit 1
+fi
+
+output=$(perl $(dirname "$0")/calcrom.pl $build_name.map | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')
+curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST $CALCROM_DISCORD_WEBHOOK_URL