Skip to content

Review Dependabot minor and major updates with Claude Code#19

Merged
danielorbach merged 14 commits intomainfrom
claudependabot
Mar 12, 2026
Merged

Review Dependabot minor and major updates with Claude Code#19
danielorbach merged 14 commits intomainfrom
claudependabot

Conversation

@danielorbach
Copy link
Collaborator

@danielorbach danielorbach commented Mar 12, 2026

The existing Dependabot workflow auto-approves and merges patch updates but left minor and major updates for human review (see #16). This completes the three-tier automation by replacing those TODOs with Claude-assisted review.

Minor updates are reviewed and auto-merged if Claude approves. Major updates receive analysis with migration notes and changelog research, but require a human to approve and merge. Tool permissions follow a least-privilege model: gh pr review commands are narrowly scoped, and major reviews explicitly disallow approval via --disallowedTools. The minor review prompt flags v0.x dependencies, where semver permits breaking changes in minor bumps.

Review and merge are split into separate jobs so each can declare its own least-privilege permission set: the review job holds id-token: write for Claude's OIDC tokens but only contents: read, while the merge job holds contents: write but no id-token. This follows the principle of least privilege at the job level, narrowing the blast radius of each token.

The Claude Code "app" integration for issues and PRs (originally planned in #5) was dropped in favor of the local Claude Code experience; the prior attempt is preserved in #18.

Closes #6.

The agent determines whether to approve on its own.
Major updates may contain breaking changes that warrant human review.
Claude analyzes the diff, fetches release notes and changelogs, and posts
a review comment with migration notes, but does NOT approve or merge.

The --disallowedTools flag explicitly prevents gh pr review --approve,
providing a safety net beyond the prompt instruction.
Three issues addressed:

1. Bot actor validation: claude-code-action v1.0.30 added checkHumanActor
   validation that rejects bot-triggered workflows by default. The
   allowed_bots input opts in Dependabot explicitly.

2. Repository context: without a local checkout, gh commands fail to infer
   the repository. GH_REPO provides this context explicitly.

3. Tool scoping: minor reviews are restricted to gh pr diff/view/review.
   Major reviews additionally allow WebFetch and WebSearch for changelog
   research but explicitly disallow approval commands. --max-turns caps
   prevent runaway behavior (25 minor, 50 major).
Separates the non-deterministic Claude approval from the deterministic
merge operation, making the workflow behavior more predictable. Reorders
steps so reviews come first, then merges (patch and minor).
Adds ASCII diagram of the review & merge paths, notes on pull_request
vs pull_request_target (OIDC limitation with Dependabot PRs), and
squash commit body overrides.
Explains that enabling commit signing would allow Claude to commit via
MCP, which is undesirable for dependency review workflows.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Dependabot auto-merge workflow to add Claude-assisted review for minor and major dependency updates, completing the “review before merge” automation tier that was previously left for humans.

Changes:

  • Adds Claude Code Action steps to review minor updates (approve + auto-merge) and analyze major updates (comment-only, human merge).
  • Updates workflow permissions and documentation to support Claude’s token generation and least-privilege intent.
  • Renames/restructures the workflow/job and expands the in-file documentation describing the decision flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

A local checkout lets Claude inspect the codebase with Read/Grep/Glob,
run Go tooling (go mod graph, go vet), and infer the repo context from
the git remote. This eliminates the GH_REPO workaround and the git
credential errors that appeared without a working directory.

Credentials are not persisted since the review steps use gh (which
manages its own token) rather than git push.
The workflow permissions are read-only except for PR approval, which
is already guarded by narrow gh pr review scoping (and --disallowedTools
for major). The remaining gh subcommands (issue, search, run, workflow,
release) are safe to allow and help Claude research context. Go tooling
lets Claude verify compilation and inspect the dependency graph.
Semver treats everything before v1.0.0 as unstable: minor bumps in
v0.x may contain breaking changes. The prompt now flags this so Claude
applies extra scrutiny to pre-v1 minor updates.
@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

📝 Walkthrough

Walkthrough

Replaces the existing Dependabot auto-merge workflow with an enhanced version that integrates Claude API for intelligent code review of dependency updates. The new workflow automates approval and merging of patch and minor updates while routing major updates for Claude-assisted analysis.

Changes

Cohort / File(s) Summary
Dependabot Automation Upgrade
\.github/workflows/claudependabot\.yml
New workflow implementing two-stage automation: Review job fetches Dependabot metadata and conditionally invokes Claude for minor/major update analysis; Merge job auto-merges updates with appropriate handling per update type (patch auto-approved, minor after Claude review, major after analysis).
Legacy Workflow Removal
\.github/workflows/dependabot-automerge\.yml
Deleted original Dependabot workflow that provided basic patch auto-merge with TODO placeholders for Claude integration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hops with joy at dependency care,
Claude reviews what updates declare,
Patches merge with gentle speed,
While major bumps get reviewed indeed!
No more manual work to bear—
Dependabot dreams come true in air! 🚀✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Claude-powered review automation for Dependabot minor and major updates, which is the primary objective of the PR.
Linked Issues check ✅ Passed The PR implements the pending objectives from issue #6: patch updates are auto-merged after CI, and minor/major updates receive automated review via Claude before merging, fulfilling the tiered dependency management strategy.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the Dependabot review automation: the new claudependabot.yml adds Claude-assisted review logic, and dependabot-automerge.yml deletion removes the placeholder workflow being superseded.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claudependabot
📝 Coding Plan for PR comments
  • Generate coding plan

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

This comment was marked as off-topic.

@coderabbitai

This comment was marked as off-topic.

The single job interleaved trust decisions (approve, Claude review) with
housekeeping (auto-merge with clean commit body). Two jobs make the flow
easier to follow and let each job declare only the permissions it needs.

Pure structural move: no step logic changes, no new steps.
Major updates now get clean squash commit bodies when a human eventually
approves, instead of inheriting the Dependabot changelog.
Squash-merge commits from Dependabot are otherwise indistinguishable
from human-merged ones in git log. The trailer makes it easy to filter
or audit automated merges.
The merge job only runs gh CLI commands (no checkout, no build tools),
so ubuntu-slim is sufficient and faster to provision.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/claudependabot.yml (1)

130-135: Potential gap in --disallowedTools pattern.

The current disallow patterns block gh pr review --approve:* and gh pr review -a:*, but gh CLI allows combined short flags. For example, gh pr review -ab "message" (approve with body) might not match either pattern. Consider also blocking patterns like Bash(gh pr merge:*) to prevent direct merge attempts.

The prompt instruction on line 127 provides defense-in-depth, but tightening the tool restrictions would add an extra layer.

🔧 Suggested additional disallowed patterns
             --allowedTools "Bash(go:*),WebFetch,WebSearch"
             --disallowedTools "Bash(gh pr review --approve:*),Bash(gh pr review -a:*)"
+            --disallowedTools "Bash(gh pr merge:*),Bash(gh pr close:*)"
             --max-turns 25
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claudependabot.yml around lines 130 - 135, The
--disallowedTools list in the claude_args block is too narrow: update the
--disallowedTools entry to include patterns that cover combined short flags and
merge commands (e.g., add patterns like Bash(gh pr review -a*:*), Bash(gh pr
review -ab*:*), Bash(gh pr review -am*:*), Bash(gh pr review -ba*:*), and
Bash(gh pr review -a*), plus Bash(gh pr merge:*), Bash(gh pr merge -y:*), etc.)
so that combined short-flag usages and direct merge attempts are blocked; modify
the existing --disallowedTools string in the claude_args section to append these
additional Bash(...) patterns.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/claudependabot.yml:
- Around line 167-178: The auto-merge step ("Auto-merge minor") currently runs
whenever the review job completes even if Claude did not approve; change the
merge condition to require an explicit approval output/label from the review job
(e.g., have the review job emit outputs.approved = 'true' or set a label like
"claude-approved") and update the if expression to check both update-type ==
'version-update:semver-minor' AND the review approval (for example: if:
steps.metadata.outputs.update-type == 'version-update:semver-minor' &&
needs.claude-review.outputs.approved == 'true'), or alternatively call the
GitHub API to verify an actual PR approval before running gh pr merge; also
adjust the PR body message so it only claims "reviewed by Claude" when approved.
- Around line 61-68: The workflow uses a non-existent checkout action version
"actions/checkout@v6"; update the checkout step to a valid release such as
"actions/checkout@v5" or a pinned "actions/checkout@v5.0.0" by replacing the
"uses" value referencing actions/checkout@v6 with the chosen valid tag, keeping
the existing "persist-credentials: false" line unchanged to preserve the
security behavior.

---

Nitpick comments:
In @.github/workflows/claudependabot.yml:
- Around line 130-135: The --disallowedTools list in the claude_args block is
too narrow: update the --disallowedTools entry to include patterns that cover
combined short flags and merge commands (e.g., add patterns like Bash(gh pr
review -a*:*), Bash(gh pr review -ab*:*), Bash(gh pr review -am*:*), Bash(gh pr
review -ba*:*), and Bash(gh pr review -a*), plus Bash(gh pr merge:*), Bash(gh pr
merge -y:*), etc.) so that combined short-flag usages and direct merge attempts
are blocked; modify the existing --disallowedTools string in the claude_args
section to append these additional Bash(...) patterns.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4ae2d9e5-1f55-49cd-aa57-ded97067a175

📥 Commits

Reviewing files that changed from the base of the PR and between 898cacd and 3d0e2f7.

📒 Files selected for processing (2)
  • .github/workflows/claudependabot.yml
  • .github/workflows/dependabot-automerge.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/dependabot-automerge.yml

Copy link

@galactic-king galactic-king left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielorbach danielorbach merged commit 7e98998 into main Mar 12, 2026
12 checks passed
@danielorbach danielorbach deleted the claudependabot branch March 12, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configuring Dependabot for dependency management

3 participants