diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 8e12c6fa..b46cc3b5 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -17,7 +17,20 @@ jobs: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs run: | - gh pr merge "$PR_URL" --auto --squash --body="Co-authored-by: Boni Garcia " + max_retries=10 + retry_count=0 + sleep_duration=1 + while ! gh pr merge "$PR_URL" --auto --squash --body="Co-authored-by: Boni Garcia "; do + retry_count=$((retry_count+1)) + if [ $retry_count -ge $max_retries ]; then + echo "Command failed after $retry_count attempts." + exit 1 + fi + echo "Command failed. Retrying in $sleep_duration seconds..." + sleep $sleep_duration + sleep_duration=$((sleep_duration * 2)) # Exponential backoff + done + echo "Command succeeded after $retry_count attempts." env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}