Game Ops Cron #6682
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: Game Ops Cron | |
| on: | |
| schedule: | |
| - cron: "*/5 * * * *" | |
| workflow_dispatch: | |
| concurrency: | |
| group: game-ops-cron | |
| cancel-in-progress: false | |
| jobs: | |
| trigger-game-ops: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Validate required secrets | |
| env: | |
| GAME_OPS_CRON_URL: ${{ secrets.GAME_OPS_CRON_URL }} | |
| CRON_SECRET: ${{ secrets.CRON_SECRET }} | |
| run: | | |
| if [ -z "$GAME_OPS_CRON_URL" ]; then | |
| echo "Missing required GitHub secret: GAME_OPS_CRON_URL" | |
| exit 1 | |
| fi | |
| if [ -z "$CRON_SECRET" ]; then | |
| echo "Missing required GitHub secret: CRON_SECRET" | |
| exit 1 | |
| fi | |
| - name: Trigger game ops cycle | |
| env: | |
| GAME_OPS_CRON_URL: ${{ secrets.GAME_OPS_CRON_URL }} | |
| CRON_SECRET: ${{ secrets.CRON_SECRET }} | |
| run: | | |
| RESPONSE_BODY="$(mktemp)" | |
| HTTP_CODE="$(curl -sS -L -o "$RESPONSE_BODY" -w "%{http_code}" \ | |
| --max-time 45 \ | |
| --connect-timeout 10 \ | |
| --max-redirs 5 \ | |
| --retry 2 \ | |
| --retry-all-errors \ | |
| -H "Authorization: Bearer $CRON_SECRET" \ | |
| -H "Accept: application/json" \ | |
| "$GAME_OPS_CRON_URL")" | |
| echo "HTTP $HTTP_CODE" | |
| cat "$RESPONSE_BODY" | |
| if [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 300 ]; then | |
| echo "Game ops cron endpoint returned a non-2xx response" | |
| exit 1 | |
| fi |