ai_agent/constants/
github_app.rs1pub const PR_TITLE: &str = "Add Claude Code GitHub Workflow";
4
5pub const GITHUB_ACTION_SETUP_DOCS_URL: &str =
6 "https://github.com/anthropics/claude-code-action/blob/main/docs/setup.md";
7
8pub const WORKFLOW_CONTENT: &str = r#"name: Claude Code
9
10on:
11 issue_comment:
12 types: [created]
13 pull_request_review_comment:
14 types: [created]
15 issues:
16 types: [opened, assigned]
17 pull_request_review:
18 types: [submitted]
19
20jobs:
21 claude:
22 if: |
23 (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
24 (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
25 (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
26 (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
27 runs-on: ubuntu-latest
28 permissions:
29 contents: read
30 pull-requests: read
31 issues: read
32 id-token: write
33 actions: read
34 steps:
35 - name: Checkout repository
36 uses: actions/checkout@v4
37 with:
38 fetch-depth: 1
39
40 - name: Run Claude Code
41 id: claude
42 uses: anthropics/claude-code-action@v1
43 with:
44 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
45 additional_permissions: |
46 actions: read
47
48"#;
49
50pub const PR_BODY: &str = r#"## 🤖 Installing Claude Code GitHub App
51
52This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.
53
54### What is Claude Code?
55
56[Claude Code](https://claude.com/claude-code) is an AI coding agent that can help with:
57- Bug fixes and improvements
58- Documentation updates
59- Implementing new features
60- Code reviews and suggestions
61- Writing tests
62- And more!
63
64### How it works
65
66Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
67Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
68
69### Important Notes
70
71- **This workflow won't take effect until this PR is merged**
72- **@claude mentions won't work until after the merge is complete**
73- The workflow runs automatically whenever Claude is mentioned in PR or issue comments
74- Claude gets access to the entire PR or issue context including files, diffs, and previous comments
75
76### Security
77
78- Our Anthropic API key is securely stored as a GitHub Actions secret
79- Only users with write access to the repository can trigger the workflow
80- All Claude runs are stored in the GitHub Actions run history
81- Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
82- We can add more allowed tools by adding them to the workflow file like:
83
84```
85allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)
86```
87
88There's more information in the [Claude Code action repo](https://github.com/anthropics/claude-code-action).
89
90After merging this PR, let's try mentioning @claude in a comment on any PR to get started!"#;
91
92pub const CODE_REVIEW_PLUGIN_WORKFLOW_CONTENT: &str = r#"name: Claude Code Review
93
94on:
95 pull_request:
96 types: [opened, synchronize, ready_for_review, reopened]
97
98jobs:
99 claude-review:
100 runs-on: ubuntu-latest
101 permissions:
102 contents: read
103 pull-requests: read
104 issues: read
105 id-token: write
106
107 steps:
108 - name: Checkout repository
109 uses: actions/checkout@v4
110 with:
111 fetch-depth: 1
112
113 - name: Run Claude Code Review
114 id: claude-review
115 uses: anthropics/claude-code-action@v1
116 with:
117 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
118 plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
119 plugins: 'code-review@claude-code-plugins'
120 prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
121
122"#;