slash-commands: add hardened Dependabot auto-approve mode#19
Merged
Conversation
Opt-in via new 'dependabot-auto-approve' input (mode 'dev-patch-minor'). When enabled, Dependabot PRs are evaluated on pull_request_target opened/reopened and on check_suite completed for dependabot/ branches, and approved + labeled + auto-merged only when ALL gates hold: 1. Author is the real dependabot[bot] app (login AND user id 49699333) 2. Same-repo head on a dependabot/ branch (never forks) 3. Every commit signature-verified and dependabot-authored 4. Changed files a subset of 'dependabot-allowed-files' (exact paths) 5. Every updated dependency direct:development with semver-patch/minor update per Dependabot's commit metadata (missing metadata = no approve) 6. CI green on head SHA: all check runs success/neutral/skipped with at least one non-skipped check, combined status success if any exist 7. PR open, non-draft, conflict-free, not on hold Every gate fails closed, logging the reason to the action log only. Approvals use a distinct marker (slash-commands-dependabot-auto) that push invalidation now dismisses alongside /lgtm approvals; after a human push, gate 3 fails permanently so only /lgtm can accept the PR. Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_019ygNtiNcAaqTRnQjHCDkVS
localden
marked this pull request as ready for review
July 6, 2026 18:08
localden
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Den Delimarsky · Slack thread
Before / After
Before: every Dependabot PR sits until a core/lead maintainer types
/lgtm, even a patch bump to a dev dependency with green CI.After (opt-in, per consuming repo): Dependabot PRs that pass every check in the policy below get the
acceptedlabel, an APPROVE review from mcp-commander, and auto-merge — with no human in the loop. Anything outside the narrow scope (prod deps, major bumps, extra files, human pushes, red or pending CI) is left untouched for a normal/lgtm, with the skip reason written to the action log only.Security gates (ALL must hold; each fails closed)
dependabot[bot]AND user id is49699333(the app's stable id); a lookalike login can never match.dependabot/.dependabot[bot].dependabot-allowed-files(exact paths, defaultpackage.json,package-lock.json); renames are checked on both sides.updated-dependencies:block) must show every updated dependency asdependency-type: direct:developmentwithupdate-typesemver-patch or semver-minor. Missing/unparseable metadata never approves. The metadata is trustworthy at this point because gate 3 already proved the commits are dependabot-authored and signed.success/neutral/skipped, at least one non-skipped check exists, and the combined commit status (if any statuses exist) issuccess. This matters becausemainrulesets require a review but no required status checks — so the approval itself must wait for CI. Pending checks exit silently; the nextcheck_suitecompletion re-evaluates.mergeable_state !== 'dirty'), and not carrying thedo-not-merge/holdlabel.Additional hardening:
<!-- slash-commands-dependabot-auto -->); the existing push-invalidation now dismisses reviews with either this or the/lgtmmarker, so any push dismisses the auto-approval./lgtm. This one-way trapdoor is intentional and documented in the README.dependabot-auto-approve: '').check_suitecompletions can't stack duplicate approvals.How
slash-commands/main.js— newhandleDependabotAutoApprove()+parseDependabotMetadata()helpers and a dispatch branch forpull_request_target(opened/reopened) andcheck_suite(completed, dependabot branches only, with apulls.listfallback when the suite payload carries nopull_requests). The accept path reuses the existingaddLabel/onAccept/enableAutoMergehelpers;dismissBotApprovalsnow matches both review markers. Newresultoutputs:dependabot-approved,dependabot-skipped.slash-commands/action.yml— new inputsdependabot-auto-approve(default''= disabled) anddependabot-allowed-files(defaultpackage.json,package-lock.json), wired through env vars like the existing inputs.slash-commands/README.md— new policy section, caller-trigger requirements (pull_request_target: [opened, reopened]+check_suite: [completed]), input/output tables, and a security-notes entry.Validation
node --check slash-commands/main.js— cleanpython3 -c "import yaml; yaml.safe_load(open('slash-commands/action.yml'))"— clean (per this repo's CLAUDE.md; there is no test harness in this repo)/lgtm-path regression) — all passingCompanion wiring PR in the spec repo: modelcontextprotocol/modelcontextprotocol (branch
claude/dependabot-auto-approve) — activates there once this merges, since the workflow pins@main.🤖 Generated with Claude Code
https://claude.ai/code/session_019ygNtiNcAaqTRnQjHCDkVS
Generated by Claude Code