Skip to content

Commit

Permalink
Add timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
muratugureminoglu authored Aug 23, 2024
1 parent 9c7c438 commit 9769c4c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,21 @@ jobs:
- name: Check runner status and wait if offline
id: check_status
run: |
MAX_WAIT=300
WAIT_INTERVAL=10
ELAPSED_TIME=0
RUNNER_STATUS=$(curl -s -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$REPO/actions/runners | jq -r '.runners[0].status')
echo "Initial Runner status is: $RUNNER_STATUS"

while [[ "$RUNNER_STATUS" != "online" ]]; do
echo "Runner is $RUNNER_STATUS. Waiting for 10 seconds..."
sleep 10
while [[ "$RUNNER_STATUS" != "online" && "$ELAPSED_TIME" -lt "$MAX_WAIT" ]]; do
echo "Runner is $RUNNER_STATUS. Waiting for $WAIT_INTERVAL seconds..."
sleep $WAIT_INTERVAL
ELAPSED_TIME=$((ELAPSED_TIME + WAIT_INTERVAL))
RUNNER_STATUS=$(curl -s -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
Expand Down

0 comments on commit 9769c4c

Please sign in to comment.