mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
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:
84
.github/workflows/test-custom-executable.yml
vendored
Normal file
84
.github/workflows/test-custom-executable.yml
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
name: Test Custom Claude Code Executable
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test-custom-executable:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
|
||||
- name: Install Claude Code manually
|
||||
run: |
|
||||
echo "Installing Claude Code using install script..."
|
||||
curl -fsSL https://claude.ai/install.sh | bash -s latest
|
||||
echo "Claude Code installed at: $HOME/.local/bin/claude"
|
||||
|
||||
# Verify installation
|
||||
if [ -f "$HOME/.local/bin/claude" ]; then
|
||||
echo "✅ Claude executable found"
|
||||
ls -la "$HOME/.local/bin/claude"
|
||||
else
|
||||
echo "❌ Claude executable not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Test with custom executable path
|
||||
id: custom-exe-test
|
||||
uses: ./base-action
|
||||
with:
|
||||
prompt: |
|
||||
List the files in the current directory starting with "package"
|
||||
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
path_to_claude_code_executable: /home/runner/.local/bin/claude
|
||||
allowed_tools: "LS,Read"
|
||||
timeout_minutes: "3"
|
||||
|
||||
- name: Verify custom executable output
|
||||
run: |
|
||||
OUTPUT_FILE="${{ steps.custom-exe-test.outputs.execution_file }}"
|
||||
CONCLUSION="${{ steps.custom-exe-test.outputs.conclusion }}"
|
||||
|
||||
echo "Conclusion: $CONCLUSION"
|
||||
echo "Output file: $OUTPUT_FILE"
|
||||
|
||||
if [ "$CONCLUSION" = "success" ]; then
|
||||
echo "✅ Action completed successfully with custom executable"
|
||||
else
|
||||
echo "❌ Action failed with custom executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$OUTPUT_FILE" ]; then
|
||||
if [ -s "$OUTPUT_FILE" ]; then
|
||||
echo "✅ Execution log file created successfully with content"
|
||||
echo "Validating JSON format:"
|
||||
if jq . "$OUTPUT_FILE" > /dev/null 2>&1; then
|
||||
echo "✅ Output is valid JSON"
|
||||
echo "Content preview:"
|
||||
head -c 500 "$OUTPUT_FILE"
|
||||
echo ""
|
||||
|
||||
# Verify the task was completed
|
||||
if grep -q "package" "$OUTPUT_FILE"; then
|
||||
echo "✅ Claude successfully listed package files"
|
||||
else
|
||||
echo "⚠️ Could not verify if package files were listed"
|
||||
fi
|
||||
else
|
||||
echo "❌ Output is not valid JSON"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ Execution log file is empty"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ Execution log file not found"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user