-
Notifications
You must be signed in to change notification settings - Fork 234
36 lines (34 loc) · 1.21 KB
/
auto-merge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Dependabot auto-merge
on: pull_request
permissions:
contents: write
pull-requests: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
run: |
max_retries=10
retry_count=0
sleep_duration=1
while ! gh pr merge "$PR_URL" --auto --squash --body="Co-authored-by: Boni Garcia <[email protected]>"; 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}}