Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
9a66562
feat: implement Claude Code GitHub Action v1.0 with auto-detection an…
km-anthropic Aug 6, 2025
da182b6
test + formatting fixes
km-anthropic Aug 7, 2025
acbef8d
feat: simplify to two modes (tag and agent) for v1.0
km-anthropic Aug 7, 2025
65896ab
fix: address PR review comments for v1.0 simplification
km-anthropic Aug 7, 2025
1846b19
Merge branch 'main' into v1-dev
km-anthropic Aug 7, 2025
18bb011
chore: remove unused js-yaml dependencies
km-anthropic Aug 7, 2025
cc07dbf
fix: remove experimental-review mode reference from MCP config
km-anthropic Aug 7, 2025
36c720c
prettify
km-anthropic Aug 7, 2025
dfcaac8
feat: add claudeArgs input for direct CLI argument passing
km-anthropic Aug 7, 2025
b6238ad
refactor: use industry-standard shell-quote for argument parsing
km-anthropic Aug 7, 2025
e2bdca6
bun format
km-anthropic Aug 7, 2025
a7759cf
feat: add claudeArgs input for direct CLI argument passing
km-anthropic Aug 7, 2025
f2775d6
format
km-anthropic Aug 7, 2025
f592586
refactor: complete v1.0 simplification by removing all legacy inputs
km-anthropic Aug 8, 2025
f407f21
fix: update MCP server tests after removing additionalPermissions
km-anthropic Aug 8, 2025
ed42f1a
model version update
km-anthropic Aug 8, 2025
90461a9
Merge branch 'main' of https://github.com/anthropics/claude-code-acti…
km-anthropic Aug 8, 2025
3d480aa
Merge branch 'main' of https://github.com/anthropics/claude-code-acti…
km-anthropic Aug 8, 2025
450e1a8
Update package json
km-anthropic Aug 8, 2025
e2aee89
remove deprecated workflow file (tests features we no longer support)
km-anthropic Aug 8, 2025
1b4fc38
Simplify agent mode and re-add additional_permissions input
km-anthropic Aug 8, 2025
5bdb1e4
Fix MCP config not being passed to Claude CLI
km-anthropic Aug 8, 2025
d5fbc80
Fix MCP tool availability and shell escaping in tag mode
km-anthropic Aug 11, 2025
c93188b
Merge branch 'main' into v1-dev
km-anthropic Aug 11, 2025
c7801e9
bun format
km-anthropic Aug 11, 2025
65d9b31
tests, typecheck, format
km-anthropic Aug 11, 2025
0e90e18
registry test update
km-anthropic Aug 11, 2025
d7a5b00
Update agent mode to have github server as a default
km-anthropic Aug 11, 2025
c03f13d
Fix agent mode to include GitHub MCP server with proper token
km-anthropic Aug 11, 2025
8084086
Simplify review workflow - prevent multiple submissions
km-anthropic Aug 11, 2025
55e9436
Add GitHub MCP server and context prefix to agent mode
km-anthropic Aug 12, 2025
86e2835
Delete .github/workflows/claude-auto-review-test.yml
km-anthropic Aug 12, 2025
24433f3
Remove github_comment and inline_comment servers from agent mode defa…
km-anthropic Aug 12, 2025
30fb4ed
Remove all default MCP servers from agent mode
km-anthropic Aug 12, 2025
73948c3
Remove GitHub context prefixing and clean up agent mode
km-anthropic Aug 12, 2025
eb146ef
Merge branch 'main' of https://github.com/anthropics/claude-code-acti…
km-anthropic Aug 12, 2025
e3b5697
Add GitHub MCP support to agent mode
km-anthropic Aug 13, 2025
d24561d
Format code with prettier
km-anthropic Aug 13, 2025
8c230f7
Fix agent mode test to expect branch values
km-anthropic Aug 13, 2025
0ac14b0
Fix agent test to handle dynamic branch names from environment
km-anthropic Aug 13, 2025
c13c2af
Better fix: Control environment variables in agent test for predictab…
km-anthropic Aug 13, 2025
ab7f1d6
minor formatting
km-anthropic Aug 13, 2025
d91030d
Simplify MCP configuration to use multiple --mcp-config flags
km-anthropic Aug 13, 2025
632f04b
feat: Copy project subagents to Claude runtime environment
km-anthropic Aug 14, 2025
30530c9
formatting
km-anthropic Aug 14, 2025
9613b21
Merge branch 'main' of https://github.com/anthropics/claude-code-acti…
km-anthropic Aug 19, 2025
4ec65ed
Add auto-fix CI workflows with slash command and inline approaches
km-anthropic Aug 19, 2025
8d32355
Add workflow_run event support and auto-fix CI workflows
km-anthropic Aug 19, 2025
91034c2
Use proper WorkflowRunEvent type instead of any
km-anthropic Aug 19, 2025
52736c6
bun formatting
km-anthropic Aug 19, 2025
bf04905
Remove auto-fix workflows and commands from v1-dev
km-anthropic Aug 19, 2025
c72a45a
feat: Expose GitHub token as action output for external use
katchu11 Aug 20, 2025
130874e
Debug: Add logging and always output github_token in prepare step
katchu11 Aug 20, 2025
b12deea
Fix: Add git authentication to agent mode
katchu11 Aug 20, 2025
2ad58b1
minor bun format
katchu11 Aug 20, 2025
b69e4f8
Merge branch 'main' of https://github.com/anthropics/claude-code-acti…
katchu11 Aug 20, 2025
ccac9ce
Merge branch 'v1-dev' of https://github.com/anthropics/claude-code-ac…
katchu11 Aug 20, 2025
604ec53
remove unnecessary file
katchu11 Aug 20, 2025
b0ce9a2
fix: Add branch environment variable support to agent mode for signed…
km-anthropic Aug 21, 2025
7929f4a
feat: Add auto-fix CI workflow examples
km-anthropic Aug 21, 2025
ca512bc
fix: Fix TypeScript error in agent mode git config
km-anthropic Aug 21, 2025
5d72c06
fix: Align agent mode git config with existing patterns
km-anthropic Aug 21, 2025
f5c5d2d
refactor: Use shared configureGitAuth function in agent mode
km-anthropic Aug 21, 2025
31085bc
Merge branch 'main' of https://github.com/anthropics/claude-code-acti…
km-anthropic Aug 21, 2025
f7111a5
feat: Improve error message for 403 permission errors when committing
km-anthropic Aug 21, 2025
b903a6e
docs: Update documentation for v1.0 release (#476)
km-anthropic Aug 21, 2025
10cf63a
feat: Add comprehensive examples for hero use cases
km-anthropic Aug 21, 2025
3c6f220
Merge branch into v1-dev - resolved conflicts in base-action files
km-anthropic Aug 25, 2025
986e40a
refactor: Remove timeout_minutes parameter from action (#482)
km-anthropic Aug 25, 2025
f8c3629
refactor: Remove unused slash commands and agents copying logic
km-anthropic Aug 25, 2025
554fbba
docs: Remove references to timeout_minutes parameter
km-anthropic Aug 25, 2025
31f17eb
fix: Resolve TypeScript errors after removing slash commands
km-anthropic Aug 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/claude-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Test workflow for km-anthropic fork (v1-dev branch)
# This tests the fork implementation, not the main repo
name: Claude Code (Fork Test)

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (
contains(github.event.issue.body, '@claude') ||
contains(github.event.issue.title, '@claude')
))
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write # Required for OIDC token exchange
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run Claude Code
uses: km-anthropic/claude-code-action@v1-dev
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
1 change: 0 additions & 1 deletion .github/workflows/issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ jobs:
prompt_file: /tmp/claude-prompts/triage-prompt.txt
allowed_tools: "Bash(gh label list),mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue,mcp__github__search_issues,mcp__github__list_issues"
mcp_config: /tmp/mcp-config/mcp-servers.json
timeout_minutes: "5"
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions .github/workflows/test-base-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
prompt: ${{ github.event.inputs.test_prompt || 'List the files in the current directory starting with "package"' }}
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
allowed_tools: "LS,Read"
timeout_minutes: "3"

- name: Verify inline prompt output
run: |
Expand Down Expand Up @@ -83,7 +82,6 @@ jobs:
prompt_file: "test-prompt.txt"
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
allowed_tools: "LS,Read"
timeout_minutes: "3"

- name: Verify prompt file output
run: |
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/test-claude-env.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/test-custom-executables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
path_to_claude_code_executable: /home/runner/.local/bin/claude
path_to_bun_executable: /home/runner/.bun/bin/bun
allowed_tools: "LS,Read"
timeout_minutes: "3"

- name: Verify custom executables worked
run: |
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
"allow": ["Bash(echo:*)"]
}
}
timeout_minutes: "2"

- name: Verify echo worked
run: |
Expand Down Expand Up @@ -76,7 +75,6 @@ jobs:
"deny": ["Bash(echo:*)"]
}
}
timeout_minutes: "2"

- name: Verify echo was denied
run: |
Expand Down Expand Up @@ -114,7 +112,6 @@ jobs:
Use Bash to echo "Hello from settings file test"
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
settings: "test-settings.json"
timeout_minutes: "2"

- name: Verify echo worked
run: |
Expand Down Expand Up @@ -169,7 +166,6 @@ jobs:
Use Bash to echo "This should not work from file"
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
settings: "test-settings.json"
timeout_minutes: "2"

- name: Verify echo was denied
run: |
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Execution steps:
#### Mode System (`src/modes/`)

- **Tag Mode** (`tag/`): Responds to `@claude` mentions and issue assignments
- **Agent Mode** (`agent/`): Automated execution for workflow_dispatch and schedule events only
- **Agent Mode** (`agent/`): Direct execution when explicit prompt is provided
- Extensible registry pattern in `modes/registry.ts`

#### GitHub Integration (`src/github/`)
Expand Down Expand Up @@ -118,7 +118,7 @@ src/

- Modes implement `Mode` interface with `shouldTrigger()` and `prepare()` methods
- Registry validates mode compatibility with GitHub event types
- Agent mode only works with workflow_dispatch and schedule events
- Agent mode triggers when explicit prompt is provided

### Comment Threading

Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,23 @@

# Claude Code Action

A general-purpose [Claude Code](https://claude.ai/code) action for GitHub PRs and issues that can answer questions and implement code changes. This action listens for a trigger phrase in comments and activates Claude act on the request. It supports multiple authentication methods including Anthropic direct API, Amazon Bedrock, and Google Vertex AI.
A general-purpose [Claude Code](https://claude.ai/code) action for GitHub PRs and issues that can answer questions and implement code changes. This action intelligently detects when to activate based on your workflow context—whether responding to @claude mentions, issue assignments, or executing automation tasks with explicit prompts. It supports multiple authentication methods including Anthropic direct API, Amazon Bedrock, and Google Vertex AI.

## Features

- 🎯 **Intelligent Mode Detection**: Automatically selects the appropriate execution mode based on your workflow context—no configuration needed
- 🤖 **Interactive Code Assistant**: Claude can answer questions about code, architecture, and programming
- 🔍 **Code Review**: Analyzes PR changes and suggests improvements
- ✨ **Code Implementation**: Can implement simple fixes, refactoring, and even new features
- 💬 **PR/Issue Integration**: Works seamlessly with GitHub comments and PR reviews
- 🛠️ **Flexible Tool Access**: Access to GitHub APIs and file operations (additional tools can be enabled via configuration)
- 📋 **Progress Tracking**: Visual progress indicators with checkboxes that dynamically update as Claude completes tasks
- 🏃 **Runs on Your Infrastructure**: The action executes entirely on your own GitHub runner (Anthropic API calls go to your chosen provider)
- ⚙️ **Simplified Configuration**: Unified `prompt` and `claude_args` inputs provide clean, powerful configuration aligned with Claude Code SDK

## ⚠️ **BREAKING CHANGES COMING IN v1.0** ⚠️
## 📦 Upgrading from v0.x?

**We're planning a major update that will significantly change how this action works.** The new version will:

- ✨ Automatically select the appropriate mode (no more `mode` input)
- 🔧 Simplify configuration with unified `prompt` and `claude_args`
- 🚀 Align more closely with the Claude Code SDK capabilities
- 💥 Remove multiple inputs like `direct_prompt`, `custom_instructions`, and others

**[→ Read the full v1.0 roadmap and provide feedback](https://github.com/anthropics/claude-code-action/discussions/428)**

---
**See our [Migration Guide](./docs/migration-guide.md)** for step-by-step instructions on updating your workflows to v1.0. The new version simplifies configuration while maintaining compatibility with most existing setups.

## Quickstart

Expand All @@ -40,6 +33,7 @@ This command will guide you through setting up the GitHub app and required secre

## Documentation

- **[Migration Guide](./docs/migration-guide.md)** - **⭐ Upgrading from v0.x to v1.0**
- [Setup Guide](./docs/setup.md) - Manual setup, custom GitHub apps, and security best practices
- [Usage Guide](./docs/usage.md) - Basic usage, workflow configuration, and input parameters
- [Custom Automations](./docs/custom-automations.md) - Examples of automated workflows and custom prompts
Expand Down
88 changes: 21 additions & 67 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Claude Code Action Official"
description: "General-purpose Claude agent for GitHub PRs and issues. Can answer questions and implement code changes."
name: "Claude Code Action v1.0"
description: "Flexible GitHub automation platform with Claude. Auto-detects mode based on event type: PR reviews, @claude mentions, or custom automation."
branding:
icon: "at-sign"
color: "orange"
Expand Down Expand Up @@ -28,50 +28,9 @@ inputs:
required: false
default: ""

# Mode configuration
mode:
description: "Execution mode for the action. Valid modes: 'tag' (default - triggered by mentions/assignments), 'agent' (for automation with no trigger checking), 'experimental-review' (experimental mode for code reviews with inline comments and suggestions)"
required: false
default: "tag"

# Claude Code configuration
model:
description: "Model to use (provider-specific format required for Bedrock/Vertex)"
required: false
anthropic_model:
description: "DEPRECATED: Use 'model' instead. Model to use (provider-specific format required for Bedrock/Vertex)"
required: false
fallback_model:
description: "Enable automatic fallback to specified model when primary model is unavailable"
required: false
allowed_tools:
description: "Additional tools for Claude to use (the base GitHub tools will always be included)"
required: false
default: ""
disallowed_tools:
description: "Tools that Claude should never use"
required: false
default: ""
custom_instructions:
description: "Additional custom instructions to include in the prompt for Claude"
required: false
default: ""
direct_prompt:
description: "Direct instruction for Claude (bypasses normal trigger detection)"
required: false
default: ""
override_prompt:
description: "Complete replacement of Claude's prompt with custom template (supports variable substitution)"
required: false
default: ""
mcp_config:
description: "Additional MCP configuration (JSON string) that merges with the built-in GitHub MCP servers"
additional_permissions:
description: "Additional permissions to enable. Currently supports 'actions: read' for viewing workflow results"
required: false
default: ""
claude_env:
description: "Custom environment variables to pass to Claude Code execution (YAML format)"
prompt:
description: "Instructions for Claude. Can be a direct prompt or custom template."
required: false
default: ""
settings:
Expand All @@ -98,14 +57,18 @@ inputs:
required: false
default: "false"

max_turns:
description: "Maximum number of conversation turns"
claude_args:
description: "Additional arguments to pass directly to Claude CLI"
required: false
default: ""
mcp_config:
description: "Additional MCP configuration (JSON string) that merges with built-in GitHub MCP servers"
required: false
default: ""
timeout_minutes:
description: "Timeout in minutes for execution"
additional_permissions:
description: "Additional GitHub permissions to request (e.g., 'actions: read')"
required: false
default: "30"
default: ""
use_sticky_comment:
description: "Use just one comment to deliver issue/PR comments"
required: false
Expand Down Expand Up @@ -134,6 +97,9 @@ outputs:
branch_name:
description: "The branch created by Claude Code for this execution"
value: ${{ steps.prepare.outputs.CLAUDE_BRANCH }}
github_token:
description: "The GitHub token used by the action (Claude App token if available)"
value: ${{ steps.prepare.outputs.github_token }}

runs:
using: "composite"
Expand Down Expand Up @@ -166,24 +132,21 @@ runs:
bun run ${GITHUB_ACTION_PATH}/src/entrypoints/prepare.ts
env:
MODE: ${{ inputs.mode }}
PROMPT: ${{ inputs.prompt }}
TRIGGER_PHRASE: ${{ inputs.trigger_phrase }}
ASSIGNEE_TRIGGER: ${{ inputs.assignee_trigger }}
LABEL_TRIGGER: ${{ inputs.label_trigger }}
BASE_BRANCH: ${{ inputs.base_branch }}
BRANCH_PREFIX: ${{ inputs.branch_prefix }}
ALLOWED_TOOLS: ${{ inputs.allowed_tools }}
DISALLOWED_TOOLS: ${{ inputs.disallowed_tools }}
CUSTOM_INSTRUCTIONS: ${{ inputs.custom_instructions }}
DIRECT_PROMPT: ${{ inputs.direct_prompt }}
OVERRIDE_PROMPT: ${{ inputs.override_prompt }}
MCP_CONFIG: ${{ inputs.mcp_config }}
OVERRIDE_GITHUB_TOKEN: ${{ inputs.github_token }}
ALLOWED_BOTS: ${{ inputs.allowed_bots }}
GITHUB_RUN_ID: ${{ github.run_id }}
USE_STICKY_COMMENT: ${{ inputs.use_sticky_comment }}
DEFAULT_WORKFLOW_TOKEN: ${{ github.token }}
ADDITIONAL_PERMISSIONS: ${{ inputs.additional_permissions }}
USE_COMMIT_SIGNING: ${{ inputs.use_commit_signing }}
ADDITIONAL_PERMISSIONS: ${{ inputs.additional_permissions }}
CLAUDE_ARGS: ${{ inputs.claude_args }}
MCP_CONFIG: ${{ inputs.mcp_config }}
ALL_INPUTS: ${{ toJson(inputs) }}

- name: Install Base Action Dependencies
Expand Down Expand Up @@ -229,23 +192,14 @@ runs:
# Base-action inputs
CLAUDE_CODE_ACTION: "1"
INPUT_PROMPT_FILE: ${{ runner.temp }}/claude-prompts/claude-prompt.txt
INPUT_ALLOWED_TOOLS: ${{ env.ALLOWED_TOOLS }}
INPUT_DISALLOWED_TOOLS: ${{ env.DISALLOWED_TOOLS }}
INPUT_MAX_TURNS: ${{ inputs.max_turns }}
INPUT_MCP_CONFIG: ${{ steps.prepare.outputs.mcp_config }}
INPUT_SETTINGS: ${{ inputs.settings }}
INPUT_SYSTEM_PROMPT: ""
INPUT_APPEND_SYSTEM_PROMPT: ${{ env.APPEND_SYSTEM_PROMPT }}
INPUT_TIMEOUT_MINUTES: ${{ inputs.timeout_minutes }}
INPUT_CLAUDE_ENV: ${{ inputs.claude_env }}
INPUT_FALLBACK_MODEL: ${{ inputs.fallback_model }}
INPUT_CLAUDE_ARGS: ${{ steps.prepare.outputs.claude_args }}
INPUT_EXPERIMENTAL_SLASH_COMMANDS_DIR: ${{ github.action_path }}/slash-commands
INPUT_ACTION_INPUTS_PRESENT: ${{ steps.prepare.outputs.action_inputs_present }}
INPUT_PATH_TO_CLAUDE_CODE_EXECUTABLE: ${{ inputs.path_to_claude_code_executable }}
INPUT_PATH_TO_BUN_EXECUTABLE: ${{ inputs.path_to_bun_executable }}

# Model configuration
ANTHROPIC_MODEL: ${{ inputs.model || inputs.anthropic_model }}
GITHUB_TOKEN: ${{ steps.prepare.outputs.GITHUB_TOKEN }}
NODE_VERSION: ${{ env.NODE_VERSION }}
DETAILED_PERMISSION_MESSAGES: "1"
Expand Down
2 changes: 0 additions & 2 deletions base-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ Add the following to your workflow file:
| `model` | Model to use (provider-specific format required for Bedrock/Vertex) | No | 'claude-4-0-sonnet-20250219' |
| `anthropic_model` | DEPRECATED: Use 'model' instead | No | 'claude-4-0-sonnet-20250219' |
| `fallback_model` | Enable automatic fallback to specified model when default model is overloaded | No | '' |
| `timeout_minutes` | Timeout in minutes for Claude Code execution | No | '10' |
| `anthropic_api_key` | Anthropic API key (required for direct Anthropic API) | No | '' |
| `claude_code_oauth_token` | Claude Code OAuth token (alternative to anthropic_api_key) | No | '' |
| `use_bedrock` | Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API | No | 'false' |
Expand Down Expand Up @@ -320,7 +319,6 @@ You can combine MCP config with other inputs like allowed tools:
prompt: "Access the custom MCP server and use its tools"
mcp_config: "mcp-config.json"
allowed_tools: "Bash(git:*),View,mcp__server-name__custom_tool"
timeout_minutes: "15"
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
```

Expand Down
Loading
Loading