feat: add path_to_claude_code_executable input for custom Claude Code… (#480)

* feat: add path_to_claude_code_executable input for custom Claude Code installations

Adds optional input to specify a custom Claude Code executable path, bypassing automatic installation. This enables:
- Using pre-installed Claude Code binaries
- Testing with specific versions for debugging
- Custom installation paths in unique environments

Includes warning that older versions may cause compatibility issues with new features.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* test: add workflow to test custom Claude Code executable path

Adds test workflow that:
- Manually installs Claude Code via install script
- Uses the new path_to_claude_code_executable input
- Verifies the custom executable path works correctly
- Validates output and execution success

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Ashwin Bhat
2025-08-25 08:11:15 -07:00
committed by GitHub
parent 88be3fe6f5
commit dc65f4ac98
5 changed files with 123 additions and 5 deletions

View File

@@ -31,6 +31,8 @@ async function run() {
claudeEnv: process.env.INPUT_CLAUDE_ENV,
fallbackModel: process.env.INPUT_FALLBACK_MODEL,
model: process.env.ANTHROPIC_MODEL,
pathToClaudeCodeExecutable:
process.env.INPUT_PATH_TO_CLAUDE_CODE_EXECUTABLE,
});
} catch (error) {
core.setFailed(`Action failed with error: ${error}`);

View File

@@ -22,6 +22,7 @@ export type ClaudeOptions = {
fallbackModel?: string;
timeoutMinutes?: string;
model?: string;
pathToClaudeCodeExecutable?: string;
};
type PreparedConfig = {
@@ -168,7 +169,10 @@ export async function runClaude(promptPath: string, options: ClaudeOptions) {
pipeStream.destroy();
});
const claudeProcess = spawn("claude", config.claudeArgs, {
// Use custom executable path if provided, otherwise default to "claude"
const claudeExecutable = options.pathToClaudeCodeExecutable || "claude";
const claudeProcess = spawn(claudeExecutable, config.claudeArgs, {
stdio: ["pipe", "pipe", "inherit"],
env: {
...process.env,