Installation
Learn how to install and set up Claude Code Action in your repository.
Prerequisites
Before installing Claude Code Action, ensure you have:
- A GitHub repository
- Repository admin permissions
- Access to Claude Code CLI
- An Anthropic API key or Claude Code OAuth token
Quick Installation (Recommended)
The fastest way to install Claude Code Action is using the Claude Code CLI:
1. Open Claude Code
claude
2. Run Install Command
/install-github-app
This command will guide you through:
- Installing the Claude GitHub App
- Setting up required secrets
- Configuring your workflow file
Manual Installation
If you prefer to set up manually or need more control:
1. Install the Claude GitHub App
Visit https://github.com/apps/claude and install the app on your repository.
2. Set Up Authentication
Add one of the following secrets to your repository:
Option A: Anthropic API Key (Recommended)
- Go to your repository Settings
- Navigate to Secrets and variables → Actions
- Click New repository secret
- Name:
ANTHROPIC_API_KEY
- Value: Your Anthropic API key
Option B: Claude Code OAuth Token
- Go to your repository Settings
- Navigate to Secrets and variables → Actions
- Click New repository secret
- Name:
CLAUDE_CODE_OAUTH_TOKEN
- Value: Your OAuth token
3. Create Workflow File
Create .github/workflows/claude.yml
in your repository:
name: Claude Code Action
on:
issues:
types: [opened, labeled]
pull_request:
types: [opened, labeled, synchronize]
issue_comment:
types: [created]
permissions:
contents: write
issues: write
pull-requests: write
jobs:
claude:
runs-on: ubuntu-latest
steps:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
# Or use OAuth token:
# claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
4. Commit and Push
git add .github/workflows/claude.yml
git commit -m "Add Claude Code Action workflow"
git push
Alternative Authentication Methods
Amazon Bedrock
- uses: anthropics/claude-code-action@v1
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-1
Google Vertex AI
- uses: anthropics/claude-code-action@v1
with:
gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
gcp_service_account_key: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
gcp_region: us-central1
Custom GitHub App Setup (Advanced)
For organizations requiring a custom GitHub App:
1. Create GitHub App
- Go to GitHub Settings → Developer settings → GitHub Apps
- Click New GitHub App
- Configure minimum permissions:
- Contents: Read & Write
- Issues: Read & Write
- Pull requests: Read & Write
2. Generate Private Key
- In your GitHub App settings
- Scroll to Private keys
- Click Generate a private key
- Download and secure the
.pem
file
3. Install App on Repository
- Go to your GitHub App settings
- Click Install App
- Select target repositories
4. Add Secrets
Add these secrets to your repository:
APP_ID
: Your GitHub App IDAPP_PRIVATE_KEY
: Contents of the.pem
file
5. Update Workflow
- uses: anthropics/claude-code-action@v1
with:
github_app_id: ${{ secrets.APP_ID }}
github_app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
Verification
After installation, test the action by:
- Creating a new issue or pull request
- Adding the label
claude
(if using label-based triggers) - Checking the Actions tab for workflow runs
Security Best Practices
- Never commit API keys directly to your repository
- Use GitHub Actions secrets for all sensitive values
- Regularly rotate API keys and tokens
- Avoid logging sensitive variables in workflow outputs
- Review GitHub App permissions regularly
Troubleshooting
Action Not Triggering
- Verify the workflow file is in
.github/workflows/
- Check that required secrets are set
- Ensure the GitHub App is installed on the repository
- Review workflow trigger conditions
Authentication Errors
- Confirm API key is valid and active
- Check secret names match workflow configuration
- Verify GitHub App has necessary permissions
Permission Errors
- Ensure workflow has
contents: write
permission - Verify GitHub App has required repository access
- Check organization-level restrictions
Next Steps
On This Page
- Prerequisites
- Quick Installation (Recommended)
- 1. Open Claude Code
- 2. Run Install Command
- Manual Installation
- 1. Install the Claude GitHub App
- 2. Set Up Authentication
- 3. Create Workflow File
- 4. Commit and Push
- Alternative Authentication Methods
- Amazon Bedrock
- Google Vertex AI
- Custom GitHub App Setup (Advanced)
- 1. Create GitHub App
- 2. Generate Private Key
- 3. Install App on Repository
- 4. Add Secrets
- 5. Update Workflow
- Verification
- Security Best Practices
- Troubleshooting
- Action Not Triggering
- Authentication Errors
- Permission Errors
- Next Steps