API Keep-Alive Ping #261
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: API Keep-Alive Ping | |
| on: | |
| schedule: | |
| - cron: '0 */3 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| ping-api: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Ping API and check response | |
| id: call | |
| run: | | |
| response=$(curl -s -w "%{http_code}" -X POST \ | |
| "https://chakaramapi.azurewebsites.net/api/ClipSync/WakeUp" \ | |
| -H "accept: */*" \ | |
| -H "Content-Type: application/json" \ | |
| -H "Authorization: Bearer ${{ secrets.WAKEUP_API_KEY }}" \ | |
| -d '{"aliveId": "c81d999a-dd2a-4903-b660-b27cc5883afa"}') | |
| http_status="${response: -3}" | |
| body="${response:0:-3}" | |
| echo "HTTP status: $http_status" | |
| echo "Response body: $body" | |
| if [ "$http_status" != "200" ]; then | |
| echo "Request failed with status $http_status" | |
| exit 1 | |
| fi | |
| - name: Success message | |
| if: success() | |
| run: echo "API keep-alive ping succeeded." |