name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
claude:
runs-on: ubuntu-latest
permissions:
id-token: write
pull-requests: write
contents: read
steps:
- uses: anthropics/claude-code-action@v1
id: claude
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
# Responds to @claude mentions in comments
claude_args: |
--append-system-prompt "Write to .claude/MEMORIES.md when a user asks you to remember something for the future."
--max-turns 20
--model claude-sonnet-4-5-20250929
- name: Output Claude execution log
if: always()
run: |
if [ -f /home/runner/work/_temp/claude-execution-output.json ]; then
echo "=== Claude Execution Log ==="
cat /home/runner/work/_temp/claude-execution-output.json
else
echo "No execution log found at /home/runner/work/_temp/claude-execution-output.json"
fi
- name: Post failure comment
if: failure() && steps.claude.outcome == 'failure'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ Claude Code Review failed to complete. This could be due to API issues, rate limits, or insufficient credits. The PR can still be merged - manual review recommended.'
})