1+ name : Bot Automation with Claude
2+
3+ on :
4+ pull_request :
5+ types : [opened, reopened]
6+ issue_comment :
7+ types : [created]
8+
9+ jobs :
10+ claude-bot-review :
11+ # Allow bots to trigger this workflow
12+ if : |
13+ github.event_name == 'pull_request' ||
14+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude'))
15+
16+ runs-on : ubuntu-latest
17+ permissions :
18+ contents : write
19+ pull-requests : write
20+ issues : write
21+ id-token : write
22+
23+ steps :
24+ # Step 1: Generate GitHub App token (required for bot actors)
25+ - name : Generate GitHub App token
26+ id : app-token
27+ uses : actions/create-github-app-token@v2
28+ with :
29+ app-id : ${{ secrets.APP_ID }}
30+ private-key : ${{ secrets.APP_PRIVATE_KEY }}
31+ permission-contents : write
32+ permission-pull-requests : write
33+ permission-issues : write
34+
35+ - name : Checkout repository
36+ uses : actions/checkout@v4
37+ with :
38+ token : ${{ steps.app-token.outputs.token }}
39+
40+ - name : Run Claude with Bot Actor
41+ uses : anthropics/claude-code-action@main
42+ with :
43+ claude_code_oauth_token : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
44+ github_token : ${{ steps.app-token.outputs.token }} # Use App token, not GITHUB_TOKEN
45+ allow_bot_actor : true # Enable bot actors to trigger Claude
46+
47+ # Option 1: direct_prompt - Adds priority instructions to standard prompt
48+ # direct_prompt: |
49+ # Focus on security implications and performance impacts.
50+ # Be extra thorough with database migrations.
51+ # Always suggest tests for new features.
52+
53+ # Option 2: override_prompt - Completely replaces the standard prompt
54+ # override_prompt: |
55+ # You are a specialized code reviewer for our API.
56+ # Review the PR focusing only on:
57+ # - API contract changes
58+ # - Breaking changes
59+ # - Performance implications
60+ # {{prDiff}} # Variables are substituted
0 commit comments