Skip to content

Commit

Permalink
Notify build failures using pushover not twist
Browse files Browse the repository at this point in the history
Using twist for personal notifications and updates was an experiment,
but I am not getting out of it what I thought I would. Instead, when
a build fails, I should get an immediate notification to my phone.
  • Loading branch information
norm committed Nov 19, 2021
1 parent c91bc83 commit bb15d3d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/rebuild.yaml
Expand Up @@ -60,6 +60,7 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
false
make clean
make baked_css
make diff_generate
Expand All @@ -80,10 +81,11 @@ jobs:
- name: Notify on failure
env:
TWIST_URL: ${{secrets.TWIST_URL}}
PUSHOVER_API_KEY: ${{secrets.PUSHOVER_API_KEY}}
PUSHOVER_USER_KEY: ${{secrets.PUSHOVER_USER_KEY}}
if: failure()
run: |
echo "" | ./script/twist_post FAILURE: $(date +'%Y-%m-%d') Site rebuild
echo "Site rebuild failed" | ./script/pushover "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- name: Register sha on site
env:
Expand Down
20 changes: 20 additions & 0 deletions script/pushover
@@ -0,0 +1,20 @@
#!/usr/bin/env -S bash -euo pipefail

declare -a params

params+=(-F "title=marknormanfrancis.com")
params+=(-F "token=$PUSHOVER_API_KEY")
params+=(-F "user=$PUSHOVER_USER_KEY")

# an argument is seen as an associated URL
[ -n "${1:-}" ] && params+=(-F "url=$1")

# the message is from STDIN
params+=(-F "message=$(cat)")

curl \
-s \
"${params[@]}" \
https://api.pushover.net/1/messages.json

echo ''

0 comments on commit bb15d3d

Please sign in to comment.