-
Notifications
You must be signed in to change notification settings - Fork 21
32 lines (27 loc) · 923 Bytes
/
sync-validators.yml
File metadata and controls
32 lines (27 loc) · 923 Bytes
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
name: Sync Validators
on:
schedule:
- cron: '*/5 * * * *'
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
environment: cron-job
steps:
- name: Trigger Validator Sync
run: |
response=$(curl -s -w "\n%{http_code}" -X POST \
-H "X-Cron-Token: ${{ secrets.CRON_SYNC_TOKEN }}" \
"${{ secrets.API_BASE_URL }}/api/v1/validators/wallets/sync/")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
echo "Response: $body"
echo "HTTP Code: $http_code"
if [ "$http_code" = "200" ] || [ "$http_code" = "202" ]; then
echo "Sync triggered successfully"
elif [ "$http_code" = "409" ]; then
echo "Sync already in progress, skipping (not a failure)"
else
echo "Sync failed with status $http_code"
exit 1
fi