A GitHub Action that leverages Claude Code to automatically generate pull requests, update existing PRs based on feedback, or create implementation plans. Designed to be triggered via workflow_dispatch for remote execution with optional callback support.
- PR Generation (
pr-gen): Create pull requests from arbitrary prompts - PR Updates (
pr-update): Update existing PRs based on review feedback - PR Review (
pr-review): Automated code review with structured feedback posted as PR comments - Plan Generation (
plan-gen): Generate detailed implementation plans without making code changes - Remote Triggering: Designed for
workflow_dispatchto be called programmatically - Callback Support: Optional webhook callback when execution completes
The pr-review mode provides automated code review capabilities:
- Comprehensive Analysis: Reviews code quality, security, performance, and best practices
- Structured Feedback: Posts organized comments with clear categories and recommendations
- GitHub Integration: Uses GitHub CLI to post review comments directly to the PR
- Actionable Insights: Provides specific suggestions for improvement with reasoning
- Professional Tone: Maintains a constructive, educational approach to code review
Example usage:
- uses: DevsyAI/devsy-action@main
with:
mode: pr-review
pr_number: 123
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
# claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # Alternative to API keyRun this in your repository root:
curl -fsSL https://raw.githubusercontent.com/DevsyAI/devsy-action/main/install-devsy.sh | bashThis automatically creates the workflow file and optionally sets up a dependency script.
If you prefer manual setup:
Copy devsy.yml to .github/workflows/devsy.yml in your repository:
mkdir -p .github/workflows
curl -o .github/workflows/devsy.yml https://raw.githubusercontent.com/DevsyAI/devsy-action/main/devsy.ymlOr manually copy the content from devsy.yml.
Enable GitHub Actions to create pull requests:
- Repository Settings: Go to Settings → Actions → General
- Enable PR Creation: Check ✅ "Allow GitHub Actions to create and approve pull requests"
- Set Permissions: Under "Workflow permissions", select "Read and write permissions"
For Organization Repos: You must enable this setting at the organization level first, then at the repository level.
Add your Claude authentication to repository secrets (choose one):
Option 1: Anthropic API Key
- Get API Key: Visit console.anthropic.com
- Add Secret: Go to Settings → Secrets and variables → Actions
- Create: Click "New repository secret"
- Name:
ANTHROPIC_API_KEY - Value: Your API key from console.anthropic.com
- Name:
Option 2: Claude Code OAuth Token (Recommended for Max Plan users)
- Get OAuth Token: Run
claude authin Claude Code CLI to get your OAuth token - Add Secret: Go to Settings → Secrets and variables → Actions
- Create: Click "New repository secret"
- Name:
CLAUDE_CODE_OAUTH_TOKEN - Value: Your OAuth token from Claude Code CLI
- Name:
OAuth tokens use flat pricing for Max Plan subscribers, while API keys use per-token billing.
To receive completion webhooks, add a callback token:
- Generate Token: Organization admin creates token at devsy.ai Settings page
- Add Secret: Go to Settings → Secrets and variables → Actions
- Create: Click "New repository secret"
- Name:
DEVSY_ORG_OAUTH_TOKEN - Value: Token from devsy.ai Settings page
- Name:
This enables secure webhook notifications when Devsy completes tasks.
For projects with dependencies, create a setup script:
mkdir -p .devsy
curl -o .devsy/setup.sh https://raw.githubusercontent.com/DevsyAI/devsy-action/main/setup.shThen edit .devsy/setup.sh and uncomment the sections you need (Python, Node.js, etc.).
Finally, configure your workflow to use the setup script:
- uses: DevsyAI/devsy-action@main
with:
mode: pr-gen
prompt: "Add new feature"
setup_script: '.devsy/setup.sh' # Add this line
allowed_tools: 'Bash(python:*),Bash(npm:*)' # Enable tools for your stackThis ensures dependencies are installed in the correct Python environment before Claude Code execution.
Instead of Anthropic API key, you can use:
- AWS Bedrock: Set
use_bedrock: true(requires AWS credentials) - Google Vertex: Set
use_vertex: true(requires GCP credentials)
mode: Action mode - must be one of:pr-gen,pr-update,pr-review, orplan-genanthropic_api_key: Your Anthropic API key (or useuse_bedrock/use_vertexfor cloud providers)
For pr-gen mode:
prompt: The implementation prompt (what changes to make)
For pr-update mode:
pr_number: The pull request number to updateprompt: Additional instructions for the update (optional)
For pr-review mode:
pr_number: The pull request number to reviewprompt: Additional review instructions (optional)
For plan-gen mode:
prompt: The planning prompt
model: Claude model to use (default:sonnet)prompt_file: Path to a file containing the prompt (alternative toprompt)custom_instructions: Additional instructions for Claudeallowed_tools: Additional tools for Claude to use (base tools are always included)disallowed_tools: Additional tools to disallow beyond the defaults (WebFetch, WebSearch)base_branch: Base branch for new PRs (default:main)callback_url: URL to POST completion status and resultscallback_auth_token: Bearer token for callback authenticationcallback_auth_header: Custom auth header name (default:Authorization)setup_script: Path to setup script to run before Claude Code executionmax_turns: Maximum number of conversation turns for Claude (default:200)timeout_minutes: Timeout in minutes for Claude Code execution (default:10)
The action includes a comprehensive set of base tools that are always available:
Base Tools (Always Included):
- File Operations:
Edit,Read,Write,Glob,Grep,LS - Git Commands:
Bash(git:*)- All git operations - Search:
Bash(rg:*)- Ripgrep for fast code search - Task Management:
Task,TodoWrite,TodoRead - GitHub CLI:
Bash(gh pr:*)- GitHub CLI PR commands
Default Disallowed Tools:
WebFetch- Web content fetchingWebSearch- Web search functionality
Additional Tools: Use allowed_tools to add more tools like:
Bash(npm install)- Specific npm commandsBash(pytest)- Python testingWebSearch- Internet search capabilities
Restricting Tools: Use disallowed_tools to prevent specific tools:
Bash(rm:*)- Prevent file deletionTask- Disable task management
Example:
allowed_tools: "Bash(npm install),Bash(npm test),WebSearch"
disallowed_tools: "Bash(rm:*),Bash(sudo:*)"The action uses an intelligent authentication system that provides the best user experience:
Primary: devsy-bot GitHub App (Recommended)
- Automatically attempts to exchange GitHub Actions token for devsy-bot access token
- Works without requiring repository "Allow GitHub Actions to create PRs" setting
- Provides devsy-bot branding on PRs and commits
- No additional setup required if devsy-bot is installed
Fallback: GitHub Actions bot
- Falls back gracefully if devsy-bot is not installed or unavailable
- Uses standard GitHub Actions bot token
- Requires "Allow GitHub Actions to create and approve pull requests" in repository settings
- Still provides full functionality
Authentication Status
- Check the
token_sourceoutput to see which method was used - View logs for detailed authentication flow information
AWS Bedrock
- Set
use_bedrock: true - Configure region and credentials via environment variables:
AWS_REGION: AWS region (e.g.,us-east-1)AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY: AWS credentials- Or use IAM roles for GitHub Actions
Google Vertex AI
- Set
use_vertex: true - Configure project and region via environment variables:
ANTHROPIC_VERTEX_PROJECT_ID: Your GCP project IDCLOUD_ML_REGION: GCP region (e.g.,us-central1)GOOGLE_APPLICATION_CREDENTIALS: Path to service account key file
Example with AWS Bedrock:
- uses: DevsyAI/devsy-action@main
with:
mode: pr-gen
prompt: "Add authentication"
use_bedrock: true
env:
AWS_REGION: us-west-2
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}conclusion: Execution status (success,failure, orno_changes)execution_file: Path to the Claude Code execution logpr_number: PR number (forpr-genandpr-updatemodes)pr_url: PR URL (forpr-genandpr-updatemodes)plan_output: Generated plan content (forplan-genmode)token_source: Authentication method used (devsy-botorgithub-actions-bot)
When a callback_url is provided, the action will send a POST request with the following JSON payload:
{
"run_id": "1234567890",
"run_url": "https://github.com/owner/repo/actions/runs/1234567890",
"mode": "pr-gen",
"conclusion": "success",
"pr_number": "123",
"pr_url": "https://github.com/owner/repo/pull/123",
"plan_output": null,
"execution_file": "claude-execution.json",
"token_source": "devsy-bot",
"timestamp": "2024-01-01T12:00:00Z"
}The action uses a two-layer prompt system for better control and consistency:
-
System Prompt (
templates/system-prompt.md): A minimal, consistent prompt that establishes Claude's role as an AI assistant working in GitHub repositories. This is the same across all modes and is not exposed to end users. -
User Prompts (mode-specific templates):
pr-gen.md- Detailed instructions for PR generationpr-update.md- Structured approach for handling PR feedbackpr-review.md- Automated code review with structured feedbackplan-gen.md- Comprehensive planning framework
This separation ensures:
- Consistent base behavior across all modes
- Full control over instructions without conflicts with base action defaults
- Clear separation between system-level setup and task-specific guidance
Templates use {{ variable }} syntax for variable substitution and can be customized to match your organization's specific requirements and coding standards.
If you see an authentication error, ensure you have:
- Added
ANTHROPIC_API_KEYorCLAUDE_CODE_OAUTH_TOKENto your repository secrets - The secret name is exactly correct (case-sensitive)
- Your credentials are valid and have sufficient credits/access
- Or configured alternative authentication (Bedrock/Vertex)
This can happen when:
- The prompt was unclear or impossible to implement
- All requested changes already exist
- Claude Code encountered an error during execution
- Check the action logs for more details
If setup fails:
- Ensure your setup script path is correct in the
setup_scriptinput - Verify the setup script exists and is executable (
chmod +x .devsy/setup.sh) - Check that your setup script includes proper error handling (
set -e) - The setup script runs after Python environment setup but before Claude Code execution
- Test your setup script locally before committing
If Claude can't find installed packages:
- Use the
setup_scriptinput instead of running setup in workflow steps - Always use
python -m pytestinstead of justpytestin your instructions - Ensure dependencies are installed via the setup script, not in earlier workflow steps
This action is built on top of claude-code-base-action and follows similar patterns to claude-code-action.