Skip to content

chore(deps): bump the github-actions group across 1 directory with 5 updates #3123

chore(deps): bump the github-actions group across 1 directory with 5 updates

chore(deps): bump the github-actions group across 1 directory with 5 updates #3123

name: Auto-merge Dependabot PRs
on:
pull_request_target:
types:
- labeled
- approved
jobs:
auto-merge:
runs-on: ubuntu-latest
# Only run for Dependabot PRs that have the dependency_approved label
if: github.actor == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'dependency_approved')
permissions:
# Required for merge operation
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Auto-merge Dependabot PR
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
# Check if PR is approved
APPROVED=$(gh pr view $PR_NUMBER --json reviewDecision -q .reviewDecision)
if [ "$APPROVED" == "APPROVED" ]; then
echo "PR #$PR_NUMBER is approved and has the dependency_approved label, merging automatically"
gh pr merge $PR_NUMBER --merge --delete-branch --body "Merged automatically by workflow [skip ci]"
else
echo "PR #$PR_NUMBER is labeled but not approved yet, skipping auto-merge"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}