Skip to content

Sync Validators

Sync Validators #4318

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