@@ -84,3 +84,107 @@ Reference in your agent: "Load `.claude/context/architecture.md` for code placem
8484
8585- [ Self-Review Reflection] ( self-review-reflection.md )
8686- [ Autonomous Quality Enforcement] ( autonomous-quality-enforcement.md )
87+
88+ ---
89+
90+ ## GitHub Actions Deployment
91+
92+ ** Deploy your Codebase Agent as a GitHub bot for team-wide access.**
93+
94+ ### Architecture: Two Complementary Approaches
95+
96+ | Approach | Location | Trigger | Use Case |
97+ | ----------| ----------| ---------| ----------|
98+ | ** Local Agent** (above) | Developer's machine | Claude Code CLI | Individual development workflows |
99+ | ** Deployed Agent** (below) | GitHub Actions | @mentions , labels | Team code reviews, PR automation |
100+
101+ ### Quick Deploy
102+
103+ ** 1. Copy the workflow file:**
104+
105+ See the [ reference implementation] ( /.github/workflows/codebase-agent.yml ) for the complete, production-ready workflow.
106+
107+ ** 2. Add GitHub Secret:**
108+
109+ - ` ANTHROPIC_API_KEY ` : Your Anthropic API key from < https://console.anthropic.com >
110+
111+ ** 3. Usage:**
112+
113+ ``` markdown
114+ # In any issue or PR:
115+ @cba please review this PR for security issues
116+ @cba help me understand this error
117+
118+ # Or use labels:
119+ cba-review → Automatic code review
120+ cba-help → Automatic analysis
121+ ```
122+
123+ ### Implementation Details
124+
125+ The reference workflow uses:
126+
127+ - ** Modular Python code** - Extracted to ` .github/scripts/codebase_agent/ ` for testability
128+ - ** Error handling** - Specific exceptions for API errors, timeouts, rate limits
129+ - ** Security** - Command sanitization to prevent prompt injection
130+ - ** Safe commands** - Only ` review ` , ` help ` , ` summarize ` , ` explain ` , ` test ` , ` security `
131+
132+ ### Optional: Vertex AI Integration
133+
134+ To use Google Vertex AI instead of Anthropic API (eliminates API key management):
135+
136+ 1 . ** Install Vertex AI SDK:**
137+
138+ ``` bash
139+ pip install google-cloud-aiplatform anthropic[vertex]
140+ ```
141+
142+ 2 . ** Set up GCP Workload Identity** (see [ Google's guide] ( https://cloud.google.com/iam/docs/workload-identity-federation ) )
143+
144+ 3 . ** Update workflow** to use AnthropicVertex client:
145+
146+ ``` python
147+ from anthropic import AnthropicVertex
148+
149+ client = AnthropicVertex(
150+ project_id = os.environ[" GCP_PROJECT_ID" ],
151+ region = " us-central1"
152+ )
153+ ```
154+
155+ ### GitHub Actions Issues
156+
157+ | Issue | Solution |
158+ | -------| ----------|
159+ | Workflow doesn't trigger | Check ` if: ` condition matches your use case |
160+ | Response not posted | Verify ` ANTHROPIC_API_KEY ` secret is set |
161+ | Module import error | Ensure ` cd .github/scripts ` before running Python |
162+ | Rate limit errors | Add concurrency limits to workflow |
163+
164+ ### Example Usage
165+
166+ ** Developer adds label:**
167+ ![ Screenshot: User adds "cba-review" label to PR]
168+
169+ ** Bot posts review:**
170+
171+ ``` markdown
172+ ## 🤖 Codebase Agent
173+
174+ I've reviewed this PR. Here are my findings:
175+
176+ ### Security
177+ ✅ No SQL injection risks
178+ ⚠️ Consider rate limiting (line 42)
179+
180+ ### Performance
181+ ⚠️ DB query in loop (lines 67-73)
182+ ✅ Good caching implementation
183+
184+ ### Suggestions
185+ 1 . Add rate limiting: ` @limits(calls=100, period=60) `
186+ 2 . Use bulk query: ` User.objects.filter(id__in=ids) `
187+
188+ ---
189+ * Powered by Vertex AI*
190+ ```
0 commit comments