Skip to content

ci fixes for claude code #11

ci fixes for claude code

ci fixes for claude code #11

name: Claude Code Review
on:
pull_request:
types: [opened, synchronize] # Runs on new PRs and updates
jobs:
code-review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
discussions: write
id-token: write
statuses: write
actions: write
steps:
# Check out the code to allow git diff operations
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for accurate diffs
# Handle PR branch checkout for forks
- name: Checkout PR branch
run: |
# Get the PR number
PR_NUMBER="${{ github.event.pull_request.number }}"
echo "Checking out PR #${PR_NUMBER}..."
# Use the GitHub CLI to checkout the PR
gh pr checkout $PR_NUMBER
# Verify the checkout
echo "Current branch details:"
git branch
git status
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Code Review with Claude
id: code-review
uses: anthropics/claude-code-action@beta
with:
# Define the review focus areas
direct_prompt: "Review the PR changes. Focus on code quality, potential bugs, and performance issues. Suggest improvements where appropriate. Pay special attention to Kubernetes operator patterns and Go best practices according to the CLAUDE.md file."
# Your GitHub token for API operations
github_token: ${{ secrets.GITHUB_TOKEN }}
# Limited tools for safer review operations
allowed_tools: |-
# Git inspection commands (read-only)
Bash(git status)
Bash(git log)
Bash(git diff --name-only HEAD~1)
Bash(git diff HEAD~1)
Bash(git show)
Bash(git blame)
# File exploration tools
View # Read file contents
GlobTool # Find files by pattern
GrepTool # Search file contents
BatchTool # Run multiple tools in parallel
# Timeout after 15 minutes
timeout_minutes: 15
# Your Anthropic API key (stored as a GitHub secret)
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}