Skip to content

Commit e23e0af

Browse files
JAORMXclaude
andauthored
feat: Add Claude PR Assistant workflow (#321)
Add GitHub Actions workflow to enable @claude mentions in issues and PRs for interactive AI assistance. Features: - Responds to @claude mentions in issue comments, PR reviews, and PR review comments - Provides context-aware assistance by accessing repository code - 20-minute timeout for safety - Requires ANTHROPIC_API_KEY secret to be configured Setup required: 1. Add ANTHROPIC_API_KEY to repository secrets (Settings → Secrets and variables → Actions) 2. Ensure GitHub Actions has appropriate permissions in repository settings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 457efd1 commit e23e0af

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/claude.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Claude PR Assistant
2+
3+
# This workflow allows mentioning @claude in issues and PRs for interactive AI assistance
4+
# Trigger conditions: issue comments, PR review comments, PR reviews, and new issues
5+
on:
6+
issue_comment:
7+
types: [created]
8+
pull_request_review_comment:
9+
types: [created]
10+
pull_request_review:
11+
types: [submitted]
12+
issues:
13+
types: [opened, edited]
14+
15+
# Permissions required for Claude to read repository content and interact with PRs/issues
16+
permissions:
17+
contents: read # Read repository files and code
18+
pull-requests: read # Read PR information and comments
19+
issues: read # Read issue information and comments
20+
actions: read # Read workflow information
21+
id-token: write # Required for authentication with Anthropic
22+
23+
jobs:
24+
claude-assistant:
25+
# Only run if the comment/issue contains @claude mention
26+
if: contains(github.event.comment.body, '@claude') || contains(github.event.issue.body, '@claude') || contains(github.event.review.body, '@claude')
27+
28+
runs-on: ubuntu-latest
29+
30+
# Set timeout to prevent runaway workflows
31+
timeout-minutes: 20
32+
33+
steps:
34+
# Check out the repository code so Claude can access it
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
# Run Claude Code Action to provide AI assistance
39+
# This action will analyze the context and respond to the @claude mention
40+
- name: Run Claude PR Assistant
41+
uses: anthropics/claude-code-action@v1
42+
with:
43+
# API key for authenticating with Anthropic's Claude API
44+
# This must be added as a repository secret at:
45+
# Settings → Secrets and variables → Actions → New repository secret
46+
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
47+
48+
# GitHub token is automatically provided by GitHub Actions
49+
# Used for reading/writing comments and accessing repository data
50+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)