Skip to content

Commit

Permalink
Improve auto-merge workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bonigarcia committed Aug 28, 2024
1 parent 9755751 commit 00f88bf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <boni.garcia@uc3m.es>"
max_retries=10
retry_count=0
sleep_duration=1
while ! gh pr merge "$PR_URL" --auto --squash --body="Co-authored-by: Boni Garcia <boni.garcia@uc3m.es>"; 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}}

0 comments on commit 00f88bf

Please sign in to comment.