Skip to content

Commit

Permalink
ci: update auto-merge.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
donBarbos committed Oct 11, 2024
1 parent 90af02a commit 2a26a4f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Automerge Dependabot PRs

on: pull_request_target

permissions:
Expand All @@ -15,8 +16,19 @@ jobs:
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
run: |
if gh pr merge --auto --squash "$PR_URL"; then
echo "PR merged successfully"
else
MERGEABLE=$(gh pr view "$PR_URL" --json mergeable --jq '.mergeable')
if [ "$MERGEABLE" = "CONFLICTING" ]; then
gh pr comment "$PR_URL" --body "@dependabot recreate"
else
echo "Merge failed for another reason"
fi
fi
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 2a26a4f

Please sign in to comment.