-
Notifications
You must be signed in to change notification settings - Fork 1
30 lines (26 loc) · 995 Bytes
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: Check Status
on:
schedule:
- cron: '0 * * * *' # Every hour
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check if the website is responding
run: |
curl -Is http://www.keays.xyz | head -n 1 | grep "200 OK"
continue-on-error: true
- name: Notify via SMS if the website is down
if: failure()
env:
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }}
TWILIO_PHONE_NUMBER: ${{ secrets.TWILIO_PHONE_NUMBER }}
TO_PHONE_NUMBER: ${{ secrets.TO_PHONE_NUMBER }}
run: |
curl -X POST "https://api.twilio.com/2010-04-01/Accounts/${TWILIO_ACCOUNT_SID}/Messages.json" \
--data-urlencode "Body=Website 👇📉" \
--data-urlencode "From=${TWILIO_PHONE_NUMBER}" \
--data-urlencode "To=${TO_PHONE_NUMBER}" \
-u "${TWILIO_ACCOUNT_SID}:${TWILIO_AUTH_TOKEN}"