-
Notifications
You must be signed in to change notification settings - Fork 23
34 lines (29 loc) · 1.11 KB
/
check_testnet.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
31
32
33
34
name: Run Script and Notify Slack
on:
#schedule:
# - cron: "17 * * * 7"
workflow_dispatch:
jobs:
run-script:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Notify Slack
run: |
output=$(python pdr check_network ppss.yaml sapphire-testnet | grep -E 'FAIL|WARNING|error' | grep -v "1h" || true)
joke=$(curl -s https://official-joke-api.appspot.com/jokes/general/random | jq -r '.[0].setup, .[0].punchline')
if [ -z "$output" ]; then
echo "No output, so no message will be sent to Slack"
else
message="Testnet Check script failed: \n${output}\n\nHere's a funny joke to make your day: ${joke}"
curl -X POST -H 'Content-type: application/json' --data '{"text":"'"$message"'"}' ${{ secrets.SLACK_WEBHOOK_URL }}
fi