name: OCR-Gateway Health Check on: schedule: - cron: "* * * * *" jobs: OCR health-check: runs-on: ubuntu-latest steps: - name: Check OCR-Gateway Health and Notify on Failure run: | success=false for i in $(seq 1 5); do response=$(curl -s -o /dev/null -w "%{http_code}" http://172.16.10.176:8890/health/API) content=$(curl -s http://172.16.10.176:8890/health/API) if [ "$response" -eq 200 ] && echo "$content" | grep -q "ok"; then echo "OCR-Gateway is healthy (Attempt $i)." success=true break else echo "OCR-Gateway health check failed (Attempt $i). HTTP Status: $response, Content: $content" if [ $i -lt 5 ]; then sleep 10 # Wait for 10 seconds before retrying fi fi done if [ "$success" = "false" ]; then echo "OCR-Gateway health check failed after 5 attempts. Sending notification to Mattermost." curl -i -X POST -H 'Content-Type: application/json' -d '{"text": "## 🚨 OCR-Gateway μƒνƒœ 확인 μ‹€νŒ¨\n**μ—”λ“œν¬μΈνŠΈ:** `http://172.16.10.176:8890/health/API`\n\nAPIκ°€ 5번의 μ‹œλ„μ— μ‘λ‹΅ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. 확인이 ν•„μš”ν•©λ‹ˆλ‹€."}' ${{ secrets.MATTERMOST_WEBHOOK }} exit 1 fi