GitHub Integration
Setting Up GitHub Integration
Claude Code integrates directly with GitHub through an official GitHub App. Once installed, Claude runs inside GitHub Actions and can be triggered by pull requests, issues, and @mentions -- transforming it from a local tool into a team-wide automation platform.
- 1.Run '/install GitHub app' in Claude Code
- 2.Install the Claude Code GitHub App on your repository
- 3.Add your Anthropic API key as a repository secret
- 4.Merge the auto-generated PR that adds two GitHub Action workflows
| Action | Trigger | What Claude Does |
|---|---|---|
| PR Review | New pull request opened | Automatically reviews code changes for bugs, security issues, and style |
| @Claude mention | @claude in issue or PR comment | Responds to the request: fix bug, answer question, implement feature |
| Custom workflows | Configurable triggers | Run custom analysis, generate documentation, validate architecture |
Default and custom GitHub integration actions
Customization and Permissions
The GitHub Actions workflows are fully customizable. You can add custom instructions, integrate MCP servers for browser testing, and define specific permissions for what Claude is allowed to do in your CI/CD pipeline.
# .github/workflows/claude-review.yml (simplified)
name: Claude Code PR Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: anthropic/claude-code-action@v1
with:
api_key: ${{ secrets.ANTHROPIC_API_KEY }}
custom_instructions: |
Focus on security issues and PII exposure.
Check all database queries for SQL injection.
allowed_tools:
- read
- grep
- commentExplicit Permissions Required
You must explicitly list every tool and MCP server permission in the GitHub Action config. There are no shortcuts or wildcards -- this is intentional for security. If Claude needs Playwright for browser testing in CI, each Playwright tool must be individually listed.
Dev Server for Browser Testing
When using Playwright MCP in GitHub Actions, add a step to start your development server before Claude runs. Claude can then visit your app in a browser, test functionality, and create visual checklists for QA.
Key Takeaways
- ✓Install via '/install GitHub app' -- adds automated PR review and @claude mention support
- ✓Claude runs inside GitHub Actions, triggered by PRs, issues, and custom workflow events
- ✓Customize workflows via .github/workflows/ config with custom instructions and tool permissions
- ✓All permissions must be explicitly listed -- no wildcards, by design for security
- ✓Combine with Playwright MCP for automated browser testing in CI/CD pipelines
Check Your Understanding
Test what you learned in this lesson.
Q1.What are the two default GitHub Actions that Claude Code adds when installed?
Q2.Why must all tool permissions be explicitly listed in GitHub Action configs?
Q3.You want Claude to visually test your app's UI in a GitHub Action. What additional setup is needed?