-
Notifications
You must be signed in to change notification settings - Fork 23
44 lines (38 loc) · 1.5 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
35
36
37
38
39
40
41
42
43
44
##
## Copyright 2024 Ocean Protocol Foundation
## SPDX-License-Identifier: Apache-2.0
##
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: Fetch the address file and move it to contracts directory
run: |
wget https://raw.githubusercontent.com/oceanprotocol/contracts/main/addresses/address.json
mkdir -p ~/.ocean/ocean-contracts/artifacts/
mv address.json ~/.ocean/ocean-contracts/artifacts/
- 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