-
Notifications
You must be signed in to change notification settings - Fork 188
feat: add Claude Code integration with slash commands and GitHub Actions #22638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add comprehensive Claude Code integration supporting both local CLI usage and automated GitHub Actions workflows: **Slash Commands** (`.claude/commands/`): - `/review-pr [number]` - Review pull requests with code quality analysis - `/analyze-issue [number]` - Analyze issues and provide fix recommendations **GitHub Actions Workflows**: - `claude.yml` - Responds to @claude mentions in issues and PRs - `claude-review-pr.yml` - Triggers when review requested from 'claude' user - `claude-analyze-issue.yml` - Automatically analyzes newly opened issues **Key Features**: - Single source of truth: workflows read slash command files - Works locally: type `/review-pr 123` in Claude Code CLI - Works in CI: workflows execute same logic automatically - No duplication: update commands once, both contexts benefit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Code Review - PR #22638: Claude Code IntegrationI've reviewed this pull request that adds Claude Code integration with slash commands and GitHub Actions workflows. Overall, this is a well-structured addition that provides good developer tooling. Here are my findings: Positive Aspects
Issues and Recommendations1. Critical: Inconsistent Action VersionsThe workflows use different versions of the Claude Code action:
Recommendation: Standardize on a single version (preferably # In claude-analyze-issue.yml, change line 33:
uses: anthropics/claude-code-action@v1 # Instead of @main2. Workflow Naming Inconsistency
3. Permissions MismatchThe workflows have slightly different permission sets:
Concern: Recommendation: Add permissions:
contents: read
pull-requests: write # Changed from 'read'
issues: read
id-token: write4. Missing Error Handling in Slash CommandsThe slash commands don't include guidance on handling cases where:
Recommendation: Add error handling guidance to the slash command files, for example: IMPORTANT GUIDELINES:
- If the PR/issue number is invalid, report this clearly and exit gracefully
- Handle API rate limits by checking response status codes
- If unable to complete the task, explain what went wrong5. Authentication InconsistencyDifferent workflows use different authentication methods:
Recommendation: Document why different auth methods are used, or standardize on one approach if both should work the same way. 6. Checkout Depth Inconsistency
Question: Does issue analysis need full git history? If not, use 7. Missing Timeout in claude.ymlThe Recommendation: Add consistent timeouts to prevent runaway workflows: jobs:
claude:
runs-on: ubuntu-latest
timeout-minutes: 15 # Add this8. Checkout Action Version Inconsistency
Recommendation: Standardize on Testing RecommendationsSince this PR doesn't include tests, consider:
SummaryThis is a valuable addition to the repository that will improve developer experience. The main concerns are:
The design is sound, but these consistency and permission issues should be addressed before merging. |
Test Results1 281 files ± 0 1 281 suites ±0 1h 16m 15s ⏱️ - 2m 53s For more details on these errors, see this check. Results for commit a95efe5. ± Comparison against base commit 46e8c23. ♻️ This comment has been updated with latest results. |
- Add pull-requests: write permission to claude-review-pr.yml for posting comments - Standardize action versions: use @v5 for checkout, @v1 for Claude Code Action - Standardize authentication: use claude_code_oauth_token across all workflows - Align fetch-depth: use fetch-depth: 1 consistently (full history not needed) - Add timeout-minutes: 10 to claude.yml workflow for consistency These changes ensure consistent configuration across all workflows and fix the permission issue that would prevent PR review comments from being posted. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Thanks for the thorough review! I've addressed all the feedback in commit 5a88548: Changes Made:✅ Fixed permissions - Added ✅ Standardized action versions:
✅ Standardized authentication - Now using ✅ Aligned fetch-depth - Using ✅ Added timeout - Added All workflows now have consistent configuration and the critical permission issue is fixed. |
Code Review SummaryThis PR adds a well-designed Claude Code integration that provides both local CLI slash commands and automated GitHub Actions workflows. The architecture is clean and follows a DRY principle by having workflows read from the slash command files. StrengthsArchitecture & Design:
Workflow Implementation:
Issues & Suggestions1. Security Concern - Overly Permissive In allowed_non_write_users: "*" # Required for issue triage workflow, if users without repo write access create issuesWhile the comment explains the reasoning, this creates potential security risks:
Recommendation: Consider one of these alternatives:
2. Missing Timeout in The jobs:
claude-review:
if: github.event.requested_reviewer.login == 'claude'
runs-on: ubuntu-latest
timeout-minutes: 10 # Add this3. Grammatical Error in Should be: "figure out the root cause and provide a plan for a potential fix for the issue" 4. GitHub Actions Field Validation In name: Claude Issue Analyzer
description: Use Claude Code to analyze new issuesGitHub Actions workflows don't support a top-level 5. Conditional Logic Clarity In if: github.event.requested_reviewer.login == 'claude'Consider adding documentation about:
6. Missing Error Handling Context The slash command files don't specify what should happen when errors occur:
Minor ObservationsPositive:
Consider:
ConclusionThis is a solid implementation with good architectural decisions. The main concerns are around security (overly permissive user access) and consistency (missing timeout). The single-source-of-truth approach is excellent and makes the integration maintainable. Recommendation: Address the security concern in item #1 before merging, as it could lead to unexpected costs and potential abuse. |
Changes security model for issue analysis from auto-triggering on all new issues to label-based triggering, addressing resource exhaustion and cost concerns. The "analyze" label triggers the workflow and is automatically removed after analysis completes. - Change issue analyzer to trigger on "analyze" label instead of auto-opening - Remove "analyze" label after Claude posts analysis comment - Remove overly permissive allowed_non_write_users setting - Add timeout-minutes to claude-review-pr.yml for consistency - Fix grammatical error in analyze-issue.md - Remove invalid 'description' field from workflow file 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updates the review-pr slash command to read and consider existing PR comments and discussions when performing code reviews. This ensures Claude has full context and can address questions or concerns raised in previous review comments. - Add step to read PR comments using `gh pr view --comments` - Include addressing existing comment concerns in review checklist 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Code Review - Updated AnalysisI've reviewed the latest changes in this PR (commit 28b55e1). Great work addressing the previous feedback! The fixes have resolved most of the critical issues. Here's my assessment: ✅ Successfully Addressed Issues
📝 Remaining Issues1. Grammar Error in
|
Addresses remaining code review feedback to improve grammar, error
handling, and context variable handling for both local and CI usage.
Changes:
- Simplify grammar: "plan to fix" instead of "plan for a potential fix for"
- Add error handling to label removal step with graceful fallback
- Restructure commands to better handle GitHub Actions context vs local usage
- Document that context variables (${{ }}) only work in GitHub Actions
- Renumber task steps for clarity after adding PR number determination step
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Code Review - PR #22638I've reviewed this PR which adds Claude Code integration with slash commands and GitHub Actions workflows. The PR has already undergone several rounds of review and improvements. Here's my assessment of the current state: Overall AssessmentThis is a well-architected addition that provides valuable automation for code reviews and issue triage. The design principle of using slash command files as the single source of truth for both CLI and CI workflows is excellent and avoids duplication. Strengths✅ Single Source of Truth: Workflows read from Remaining Issues1. Grammar Issue in
|
Changes the PR review workflow trigger from reviewer assignment to comment-based activation. This avoids permission issues where the 'claude' user cannot be assigned as a reviewer without write access. Now anyone can trigger a review by commenting "Claude review" on a PR. The workflow filters to ensure it only runs on PR comments, not issues. Changes: - Trigger on issue_comment events instead of review_requested - Add condition to check for PR comments containing "Claude review" - Update PR number reference from github.event.pull_request.number to github.event.issue.number 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fresh Code Review - PR #22638I've reviewed this PR and the extensive discussion that has already occurred. The implementation has been significantly improved through multiple iterations. Here's my assessment of the current state: Architecture ReviewStrengths: Issues Found1. Critical: Trigger Mismatch in PR Review WorkflowThe PR workflow was changed from a File: on:
issue_comment:
types: [created]
jobs:
claude-review:
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, 'Claude review')Issues:
if: |
github.event.issue.pull_request &&
contains(toLower(github.event.comment.body), 'claude review')
2. Missing GITHUB_TOKEN for gh CommandsIn Line 41-47: - name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
${{ steps.read-command.outputs.command }}
PR_NUMBER: ${{ github.event.issue.number }}Fix: Add the GITHUB_TOKEN: - name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
${{ steps.read-command.outputs.command }}
PR_NUMBER: ${{ github.event.issue.number }}The same issue exists in 3. Workflow File Trailing Newline
RecommendationsDocumentationThe PR still lacks user-facing documentation. Consider adding to the main README or creating ## Claude Code Integration
### Setup
1. Add `CLAUDE_CODE_OAUTH_TOKEN` to repository secrets
2. Configure GitHub Actions permissions for workflows
### Usage
**Automated PR Review:**
- Comment "Claude review" on any pull request to trigger a code review
**Automated Issue Analysis:**
- Add the `analyze` label to any issue to trigger analysis
- The label will be automatically removed after analysis
**Local CLI:**
- `/review-pr [number]` - Review a specific PR
- `/analyze-issue [number]` - Analyze a specific issueEnhancement Suggestions
Testing ChecklistBefore merging, please verify:
ConclusionThis is a valuable addition with a solid architectural foundation. The main issues are:
Recommendation: Address the critical The design is excellent, and with these fixes, this will be a great automation tool for the repository. |
Addresses critical review feedback to ensure gh commands work properly and improve user experience with case-insensitive comment triggers. Changes: - Add GITHUB_TOKEN env var to both workflows so gh commands can authenticate - Make PR review trigger case-insensitive using toLower() - Remove extra trailing newline from claude-review-pr.yml This ensures "Claude review", "claude review", "CLAUDE REVIEW" all work. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Code Review - Final AssessmentI've thoroughly reviewed this PR and the implementation looks excellent. This has clearly gone through multiple iterations and improvements based on feedback. Here's my assessment: Architecture ✅The design is outstanding:
Implementation Quality ✅All critical aspects are well-implemented:
Testing Verification ✅The test results show all 8,883 tests passing, indicating no regressions from these additions. Minor ObservationsThese are very minor points that don't block merging:
Recommendation: ✅ APPROVEThis PR is production-ready. The architecture is excellent, the implementation is solid, and all previous feedback has been properly addressed. The minor points above are optional improvements that can be addressed in follow-up PRs if needed. Great work on iterating through the feedback and creating a robust, maintainable integration! 🎉 |
GitHub Actions uses lower() not toLower(). This fixes the workflow validation error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
The contains() function in GitHub Actions is already case-insensitive, so no case conversion is needed. The lower() function does not exist in GitHub Actions expressions and was causing a workflow error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|



Add comprehensive Claude Code integration supporting both local CLI usage and automated GitHub Actions workflows:
Slash Commands (
.claude/commands/):/review-pr [number]- Review pull requests with code quality analysis/analyze-issue [number]- Analyze issues and provide fix recommendationsGitHub Actions Workflows:
claude.yml- Responds to @claude mentions in issues and PRsclaude-review-pr.yml- Triggers when review requested from 'claude' userclaude-analyze-issue.yml- Automatically analyzes newly opened issuesKey Features:
/review-pr 123in Claude Code CLI