Skip to content

Dependabot self-hosted runner pattern

Run Dependabot updates on your own infrastructure with self-hosted GitHub Actions runners and the dependabot/dependabot-core CLI for private registries.

Dependabot is GitHub’s built-in dependency update bot. For most public repos and private repos using public registries, GitHub’s hosted version does the job — write dependabot.yml, get PRs. The friction starts when dependencies live in private registries that the hosted Dependabot can’t reach: internal npm registries, private Maven, Artifactory, Nexus, ECR. The two answers are (a) tell hosted Dependabot about the registry with stored credentials, or (b) run the updater yourself. This article covers both, with the self-hosted runner pattern that handles the private-registry case cleanly.

How to verify

# In a repo with .github/dependabot.yml:
cat .github/dependabot.yml
gh api repos/acme/api/dependabot/secrets | jq '.secrets[].name'
gh pr list -l "dependencies" -A --json title,createdAt | jq

# Self-hosted runner check:
sudo systemctl status actions-runner.service
ls /home/runner/_work
docker ps --filter name=dependabot

# Hosted Dependabot run inspection (GitHub UI):
#   Settings → Security & analysis → Dependabot → Recent jobs

The “Recent jobs” view in the GitHub UI is the first place to look when a Dependabot update doesn’t appear — it shows the registry resolution, the version check, and the reason no PR was opened.

What’s happening

Dependabot has two pieces. The GitHub-hosted updater runs in GitHub Actions infrastructure and processes dependabot.yml declarations: it reads your manifest files (package.json, requirements.txt, go.mod, etc.), checks for newer versions, and opens PRs. The dependabot/dependabot-core library is the open-source guts of the updater — you can run it yourself to update repos where the hosted version doesn’t fit.

The hosted updater can reach private registries if you configure them in dependabot.yml and provide credentials via Dependabot secrets (separate from regular Actions secrets). For most internal Artifactory/Nexus/private-npm setups, this is enough — the credential lives in GitHub, the hosted runner uses it to authenticate, the PR opens normally.

The hosted updater cannot reach registries that require network-level access (a VPN-only registry, a registry behind your firewall with no public hostname). For those, the path is either:

  1. Self-hosted GitHub Actions runner that runs dependabot-action. The job runs on your runner, which can reach the registry.
  2. Run dependabot-core directly as a script in your own CI, generating PRs via the GitHub API.

The runtime properties: Dependabot is GitHub-centric (the PR format, the security tab integration, the rebase comments all hook into GitHub features); Renovate (see /en/knowledge-base/renovate-bot-dependency-updates/) is platform-agnostic and far more configurable. Most organizations end up running one or the other, not both.

The procedure

  1. Basic dependabot.yml (in every repo):

    version: 2
    updates:
      - package-ecosystem: npm
        directory: "/"
        schedule: { interval: "weekly", day: "monday", time: "07:00", timezone: "America/Toronto" }
        open-pull-requests-limit: 10
        groups:
          minor-patch:
            update-types: ["minor", "patch"]
        registries:
          - acme-private-npm
      - package-ecosystem: docker
        directory: "/"
        schedule: { interval: "weekly" }
      - package-ecosystem: github-actions
        directory: "/"
        schedule: { interval: "weekly" }
    registries:
      acme-private-npm:
        type: npm-registry
        url: https://npm.acme.example
        token: ${{ secrets.ACME_NPM_TOKEN }}

    Dependabot secrets are configured at org or repo level under Settings → Secrets → Dependabot — separate from Actions secrets.

  2. Self-hosted runner setup. Standard GitHub Actions self-hosted runner install:

    mkdir -p ~/actions-runner && cd ~/actions-runner
    curl -fsSL -o actions-runner.tar.gz \
      https://github.com/actions/runner/releases/download/v2.317.0/actions-runner-linux-x64-2.317.0.tar.gz
    tar xzf actions-runner.tar.gz
    ./config.sh --url https://github.com/acme --token $REG_TOKEN --labels self-hosted,dependabot
    sudo ./svc.sh install runner
    sudo ./svc.sh start
  3. Workflow to run Dependabot on the self-hosted runner. GitHub publishes the dependabot/dependabot-action action:

    name: Dependabot
    on:
      schedule: [{ cron: "0 7 * * 1" }]
      workflow_dispatch: {}
    jobs:
      update:
        runs-on: [self-hosted, dependabot]
        permissions:
          contents: write
          pull-requests: write
        steps:
          - uses: actions/checkout@v4
          - name: Run Dependabot
            uses: dependabot/fetch-metadata@v2
            with:
              ecosystem: npm
              directory: "/"
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
              NPM_TOKEN: ${{ secrets.ACME_NPM_TOKEN }}

    The runner has access to the internal npm registry; the action processes the dependabot.yml and opens PRs.

  4. Auto-merge with dependabot/fetch-metadata. Post-creation, gate on the metadata to auto-merge patch updates:

    - name: Dependabot metadata
      id: meta
      uses: dependabot/fetch-metadata@v2
      with: { github-token: "${{ secrets.GITHUB_TOKEN }}" }
    - name: Enable automerge for patch
      if: steps.meta.outputs.update-type == 'version-update:semver-patch'
      run: gh pr merge --auto --squash "$PR_URL"
      env:
        PR_URL: ${{ github.event.pull_request.html_url }}
        GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  5. Security updates separate from version updates. Dependabot security updates are triggered by GitHub’s vulnerability advisories, not by dependabot.yml schedule. They run continuously regardless of the version-update schedule. Make sure your CI doesn’t choke on the higher security-PR frequency.

  6. Grouping. Without groups:, Dependabot opens one PR per dependency. With groups:, it bundles. Grouping by update-types: ["minor", "patch"] collapses the routine churn into a single weekly PR per ecosystem.

  7. Rebase strategy. Dependabot rebases its PRs when the base branch moves. If you disable-rebase (which we sometimes do for noisy repos), open the PR fresh weekly instead.

Common pitfalls

  • Dependabot secrets vs Actions secrets. They’re different stores. The hosted Dependabot can only read Dependabot secrets; Actions can read Actions secrets. Putting the registry token in the wrong one means auth failures.
  • open-pull-requests-limit: 5 for a repo with 50 outdated deps. Five PRs open, the rest wait. Combine with groups: so the limit isn’t binding.
  • Self-hosted runner with no concurrency limit. A repo with five ecosystems all running at once on one runner serializes badly. Use one runner per ecosystem or set jobs.<id>.concurrency.
  • Registry credential expired. Dependabot opens a “registry unreachable” comment on every PR attempt. Rotate credentials proactively.
  • schedule.interval: daily for a low-velocity repo. PR spam. weekly is the right default.

We run Dependabot for clients who need to stay on GitHub-native tooling (compliance reasons, often) but have private dependency registries the hosted Dependabot can’t reach. The self-hosted runner, the Dependabot secrets store, the auto-merge gates, and the security-PR triage are operated by our team as part of /en/services/managed-operations/. For clients with more flexibility, Renovate at /en/knowledge-base/renovate-bot-dependency-updates/ is usually the better fit.