Skip to content

[KDM-TEST-FEAT-427] feat: wire copilot to live diagnostics #557

[KDM-TEST-FEAT-427] feat: wire copilot to live diagnostics

[KDM-TEST-FEAT-427] feat: wire copilot to live diagnostics #557

name: Dependabot Auto-Merge
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
dependabot:
name: Dependabot Auto-Merge
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.actor == 'dependabot[bot]' || github.event.pull_request.user.login == 'dependabot[bot]'
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Fetch Dependabot metadata
if: github.event_name == 'pull_request'
id: metadata
uses: dependabot/fetch-metadata@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Approve and Auto-Merge Single PR
if: github.event_name == 'pull_request'
run: |
gh pr review --approve "$PR_URL" || echo "PR already approved or review cannot be submitted"
if ! gh pr merge --auto --squash "$PR_URL"; then
echo "::warning::Could not enable auto-merge. Requesting Dependabot rebase..."
gh pr comment "$PR_URL" --body "@dependabot rebase" || true
fi
env:
PR_URL: ${{ github.event.pull_request.html_url }}
- name: Batch Approve and Auto-Merge All Open Dependabot PRs
if: github.event_name == 'workflow_dispatch'
run: |
prs=$(gh pr list --app dependabot --state open --json number,url --jq '.[].url')
if [ -z "$prs" ]; then
echo "No open Dependabot PRs found."
exit 0
fi
for pr in $prs; do
echo "Processing $pr..."
gh pr review --approve "$pr" || echo "Already approved or cannot review: $pr"
if ! gh pr merge --auto --squash "$pr"; then
echo "Requesting Dependabot rebase for $pr..."
gh pr comment "$pr" --body "@dependabot rebase" || true
fi
done