skip to content

What must be true for a Dependabot patch bump to merge on GitHub without a human?

level: seniorimportance: should knowfreq 40%

answer

  1. Not a Dependabot feature at all
  2. One repository setting, one per-PR flag
  3. A required human reviewer defeats it
  4. The bot's workflow token is deliberately weak
  5. Your required checks are the real gate

basics

~20 s

The repository must have auto-merge enabled and the pull request must have auto-merge turned on; then GitHub merges it once every required status check passes and every review requirement is satisfied. Branch protection is what actually decides, not Dependabot.

solid answer

~50 s

Auto-merge is a GitHub repository feature, not a Dependabot one. Three things have to line up. First, **Allow auto-merge** must be enabled in repository settings. Second, auto-merge must be turned on for that specific pull request — by a person, by a `@dependabot merge` comment, or by automation reacting to the PR. Third, the branch protection rule or ruleset on the base branch must be **satisfiable without a person**: required status checks can pass on their own, but a required CODEOWNERS review cannot, so a rule demanding human approval on the touched paths blocks auto-merge forever. One platform detail catches teams out: workflow runs triggered by Dependabot get a read-only `GITHUB_TOKEN` and cannot read normal repository secrets — only Dependabot secrets — so any automation that enables auto-merge has to be built with that constraint in mind.

code

text · 6 lines
text
@dependabot rebase              # update the branch against the base
@dependabot recreate            # discard the branch and rebuild it
@dependabot merge               # merge once all required checks pass
@dependabot squash and merge    # same, using a squash merge
@dependabot cancel merge        # cancel a previously requested merge
@dependabot close               # close the PR and stop this update

go deeper

for a junior

Know that GitHub has an auto-merge option that merges a pull request once its required checks pass, and that it must be enabled both for the repository and for the individual pull request.

for a middle

Explain that auto-merge waits on the full branch protection contract, and that a required review is a requirement CI cannot satisfy. Know the @dependabot merge comment command.

for a senior

Show the whole chain: repository setting, per-PR flag, satisfiable protection rule, the read-only GITHUB_TOKEN and separate Dependabot secrets, and a scoping rule for which bumps qualify.

for a principal

Argue the risk transfer: unattended merging moves safety from review to detection, so the case rests on the quality of required checks, deployment gates and rollback. Be ready to say which repository classes you would never allow it on.

## Auto-merge is a GitHub feature, not a Dependabot one Dependabot opens a pull request like any other contributor. What lets that pull request land unattended is GitHub's auto-merge: a flag on the PR that says "merge this as soon as every requirement is green". Nothing about Dependabot bypasses branch protection — this is the tree's split in miniature. Git does the merge; GitHub decides the policy. ## The three preconditions **1. Repository setting.** *Allow auto-merge* is off by default and lives in repository settings. Without it, the option does not exist on any pull request. **2. Auto-merge enabled on the PR.** Someone or something must turn it on. Options: a human clicks it; a maintainer comments `@dependabot merge` (merge once checks pass) or `@dependabot squash and merge`; or automation enables it when the PR opens. Teams that want this to be systematic use the `dependabot/fetch-metadata` action to read the update type from the pull request and only enable auto-merge for patch or security bumps. **3. Branch protection must be satisfiable without a human.** This is the part candidates miss. Auto-merge waits for *all* merge requirements: - Required status checks — fine, they complete on their own. - Required conversation resolution — fine unless a bot or human comments. - Required linear history, signed commits, up-to-date-with-base — all satisfiable, though the last one causes repeated rebases and re-runs. - **Required reviews, especially required review from CODEOWNERS** — not satisfiable by CI. If your ruleset demands owner approval for the paths a manifest sits in, the PR sits open indefinitely. So "how do I auto-merge Dependabot PRs" is really "what does my protection rule require, and can a machine satisfy all of it". ## The Dependabot execution context Workflow runs triggered by Dependabot's own pull requests run with a **read-only `GITHUB_TOKEN`** and do **not** receive normal repository Actions secrets; they receive **Dependabot secrets**, which are a separate store. This is a deliberate hardening: a Dependabot PR carries third-party dependency code, and giving it a write token plus your secrets would be an obvious escalation path. The practical consequences: - Automation that enables auto-merge needs permissions the default read-only token does not have, so it must be granted explicitly or run from a context that has them. - Any workflow that needs a credential on Dependabot PRs must have it stored as a Dependabot secret, not an Actions secret. - Reaching for `pull_request_target` to get around the restriction is the classic dangerous fix: it runs with the base repository's permissions in the context of untrusted content. If you propose it in an interview, be ready to explain exactly what you would refuse to check out. ## Scoping what may auto-merge Even with the mechanism working, scope it. The defensible default is: patch-level bumps and security bumps within the current major, on repositories with a test suite you actually trust, where the full suite is a required check. Anything that merges without a human is only as safe as the gate in front of it — if your required checks are a lint job and a five-second smoke test, auto-merge is just an unattended `git push` with extra steps. The second half of the scoping decision is detection, not prevention. Auto-merge means changes reach the default branch while nobody is watching, so the compensating controls are the ones that catch a bad merge afterwards: deployment gates that a human still approves, staged rollout, and an alert that ties a production regression back to the merge window. Teams that auto-merge successfully are usually the ones whose deploy pipeline is good, not the ones whose dependency review is good. ## Keeping the PR mergeable A long-lived auto-merge PR can go stale — a required check flakes, or the base branch moves and the rule demands up-to-date branches. `@dependabot rebase` refreshes the branch; `@dependabot recreate` rebuilds it from scratch. If you use a merge queue on the base branch, auto-merge hands the pull request to the queue rather than merging directly, and the queue's own checks become the final gate. ## What to say in an interview Name the three preconditions, call out that a required CODEOWNERS review makes auto-merge impossible by design, mention the read-only `GITHUB_TOKEN` and separate Dependabot secrets, and finish with the scoping judgment: auto-merge is a bet on your required checks, so state what those checks are before you argue about which bumps qualify.

  • Your ruleset requires CODEOWNERS approval on the paths containing manifests. Can auto-merge ever complete?
    Not while that requirement stands for those paths. Auto-merge waits for every merge requirement, and an owner approval requires a person or an entity with the right permission. Either scope the owner requirement so manifest-only changes are not covered, or accept that dependency PRs need a human click.
  • Why does a workflow triggered by a Dependabot pull request not see the repository's normal Actions secrets?
    Because the pull request carries third-party dependency changes, GitHub runs it with a read-only GITHUB_TOKEN and a separate Dependabot secrets store. Handing untrusted dependency content a write token plus production credentials would be a straightforward escalation path, so the platform deliberately withholds both.
  • What compensating controls would you want before enabling auto-merge on patch bumps?
    A required check that runs the real test suite rather than lint alone, a deployment step a human still approves or a staged rollout, and monitoring that lets you attribute a regression to a merge window. Auto-merge shifts your safety from review to detection, so the detection side has to be real.

saying these in an interview costs you the question

  • Thinks Dependabot can bypass branch protection
  • Believes @dependabot merge ignores failing checks
  • Expects auto-merge to work with required owner review
  • Assumes repository Actions secrets are available on Dependabot PRs
  • Enables auto-merge with only lint as a required check

context