Skip to content

Commit

Permalink
restore retriggering workflow to use different worker
Browse files Browse the repository at this point in the history
  • Loading branch information
toy committed Aug 3, 2024
1 parent e495ac5 commit 0b8de6d
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/livecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
pull_request:
schedule:
- cron: 34 5 * * *
workflow_dispatch:
inputs:
retry:
description: 'Retry attempt'
required: true
type: number
jobs:
livecheck:
runs-on: ubuntu-latest
Expand All @@ -13,18 +19,17 @@ jobs:
with:
ruby-version: '3'
bundler-cache: true
- run: |
MAX_ATTEMPTS=10
for ((attempt = 1; ; attempt++)); do
echo "#### Attempt $attempt"
if bundle exec script/livecheck; then
exit
- env:
RETRY: ${{ inputs.retry }}
RETRIES: 10
GITHUB_TOKEN: ${{ secrets.RETRY_TOKEN }}
run: |
if ! bundle exec script/livecheck; then
exit_code=$?
if (( $exit_code == 2 )) && (( ${RETRY:-0} < $RETRIES )); then
sleep 300
gh workflow run livecheck --repo $GITHUB_REPOSITORY --ref $GITHUB_REF_NAME -f retry=$(( $RETRY + 1 ))
else
exit_code=$?
if [ $exit_code -eq 2 ] && [ $attempt -lt $MAX_ATTEMPTS ]; then
sleep 300
else
exit $exit_code
fi
exit $exit_code
fi
done
fi

0 comments on commit 0b8de6d

Please sign in to comment.