Add Claude Code GitHub Workflow#1216
Conversation
PR SummaryIntegrated Claude AI assistant by adding GitHub Actions workflows that enable automated code reviews and PR assistance. The implementation includes two new workflow files for Claude integration and modifies the existing presubmit workflow. Claude can be triggered by mentioning @claude in comments and will automatically review new PRs. The system uses secure API key storage and includes configurable options for different review scenarios and permissions. Changes
autogenerated by presubmit.ai |
|
Claude finished @tombeckenham's task —— View job 🔍 Claude Code GitHub Workflows ReviewI've analyzed both workflow files that add Claude Code integration to the repository. Here's my comprehensive review: 📋 Review Tasks
✅ Strengths & Best PracticesSecurity & Permissions:
Code Quality:
Architecture:
|
There was a problem hiding this comment.
🚨 Pull request needs attention.
Review Summary
Files Processed (2)
- .github/workflows/claude-code-review.yml (1 hunk)
- .github/workflows/claude.yml (1 hunk)
Actionable Comments (3)
-
.github/workflows/claude-code-review.yml [23-26]
possible issue: "Consider adding write permissions for PR comments"
-
.github/workflows/claude.yml [15-19]
security: "Add check for repository write access"
-
.github/workflows/claude.yml [22-26]
possible issue: "Missing write permissions for Claude interactions"
Skipped Comments (0)
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write |
There was a problem hiding this comment.
The workflow currently has read-only permissions for pull requests, which may prevent Claude from adding review comments. Consider adding pull-requests: write permission to allow Claude to comment on PRs with its review findings.
| if: | | ||
| (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || | ||
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || | ||
| (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || | ||
| (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) |
There was a problem hiding this comment.
The workflow should verify that the user triggering Claude has write access to the repository for security. Add a condition like github.event.sender.permissions.push to the if statement to ensure only authorized users can trigger Claude.
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write | ||
| actions: read # Required for Claude to read CI results on PRs |
There was a problem hiding this comment.
The workflow needs write permissions to create comments and interact with PRs/issues. Add pull-requests: write and issues: write permissions to allow Claude to respond to mentions and create comments.
|
Claude finished @tombeckenham's task —— View job 🔍 Claude Code GitHub Workflows ReviewI've analyzed both workflow files that add Claude Code integration to the repository. Here's my comprehensive review: 📋 Review Tasks
✅ Strengths & Best PracticesSecurity & Permissions:
Code Quality:
Architecture:
|
There was a problem hiding this comment.
🚨 Pull request needs attention.
Review Summary
Files Processed (2)
- .github/workflows/claude-code-review.yml (1 hunk)
- .github/workflows/presubmit.yml (1 hunk)
Actionable Comments (2)
-
.github/workflows/claude-code-review.yml [23-24]
possible issue: "Insufficient permissions for code review functionality"
-
.github/workflows/claude-code-review.yml [38-38]
security: "API key exposed to pull requests from forks"
Skipped Comments (1)
-
.github/workflows/claude-code-review.yml [31-32]
enhancement: "Limited git history may affect review quality"
| contents: read | ||
| pull-requests: read |
There was a problem hiding this comment.
The workflow has pull-requests: read permission which will prevent Claude from creating review comments. Change to pull-requests: write to allow Claude to post its review findings as comments on the PR.
| id: claude-review | ||
| uses: anthropics/claude-code-action@beta | ||
| with: | ||
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
There was a problem hiding this comment.
The workflow runs on pull requests without restricting fork PRs. This could potentially expose the ANTHROPIC_API_KEY secret to malicious code in fork PRs. Consider adding if: github.event.pull_request.head.repo.full_name == github.repository to only run on PRs from the same repository, or use pull_request_target event instead.
…ons-1753390110987 closes #1215
|
Claude finished @tombeckenham's task —— View job 🔍 Claude Code GitHub Workflows ReviewI've completed a comprehensive review of the GitHub Actions workflows that add Claude Code integration to the repository. 📋 Review Summary
🔒 CRITICAL SECURITY ISSUES1. Fork PR Secret Exposure -
|
🤖 Installing Claude Code GitHub App
Closes #1215
This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.
What is Claude Code?
Claude Code is an AI coding agent that can help with:
How it works
Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
Important Notes
Security
There's more information in the Claude Code action repo.
After merging this PR, let's try mentioning @claude in a comment on any PR to get started!