Sync Validator Grafana Status #246
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Validator Grafana Status | |
| on: | |
| schedule: | |
| - cron: '*/5 * * * *' | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| environment: cron-job | |
| steps: | |
| - name: Trigger Grafana Status 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-grafana/") | |
| 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 "Grafana sync triggered successfully" | |
| elif [ "$http_code" = "409" ]; then | |
| echo "Grafana sync already in progress, skipping (not a failure)" | |
| else | |
| echo "Grafana sync failed with status $http_code" | |
| exit 1 | |
| fi |