Dependabot auto-merge not working in CI
Dependabot does not auto-merge by itself. You must enable "Allow auto-merge" on the repository and add a workflow that calls gh pr merge --auto (or the API) on Dependabot PRs after checks pass. Without both, PRs sit open even when green.
What this error means
Green Dependabot PRs with all checks passing remain open and are never merged, and there is no merge activity in the PR timeline.
gh: Auto-merge is not enabled for this repository.
Run 'gh repo edit --enable-auto-merge' or enable it in repository settings.Common causes
Repository auto-merge is disabled
Without "Allow auto-merge" enabled in repository settings, no PR (Dependabot or otherwise) can be queued for automatic merge.
No workflow enables auto-merge per PR
Auto-merge is opt-in per pull request. Nothing turns it on for Dependabot PRs unless a workflow explicitly enables it.
How to fix it
Enable repo auto-merge and add an enabling workflow
- Turn on "Allow auto-merge" in Settings > General.
- Add a workflow triggered on Dependabot PRs that enables auto-merge.
- Gate it on the actor being dependabot[bot] and on update type.
on: pull_request
permissions:
contents: write
pull-requests: write
jobs:
automerge:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}Ensure required checks can complete
Auto-merge only fires once required checks pass. Confirm Dependabot PRs actually run those checks (they trigger on pull_request).
How to prevent it
- Enable "Allow auto-merge" at the repository level once.
- Keep a single workflow that enables auto-merge for Dependabot PRs.
- Scope auto-merge to patch/minor updates you trust.