mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
feat: add path_to_bun_executable input for custom Bun installations (#481)
* feat: add path_to_bun_executable input for custom Bun installations Adds optional input to specify a custom Bun executable path, bypassing automatic installation. This enables: - Using pre-installed Bun binaries for faster workflow runs - Testing with specific Bun versions for debugging - Custom installation paths in unique environments Follows the same pattern as path_to_claude_code_executable input. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: consolidate custom executable tests into single workflow - Remove separate test-custom-executable.yml workflow - Rename test-custom-bun.yml to test-custom-executables.yml - Add comprehensive tests for custom Claude, custom Bun, and both together - Improve verification steps with better error handling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * simplify: test workflow to single job testing both custom executables - Remove individual test jobs for Claude and Bun - Keep only the combined test that validates both custom executables work together - Simplifies CI workflow and reduces redundant testing 🤖 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
84
.github/workflows/test-custom-executable.yml
vendored
@@ -1,84 +0,0 @@
|
|||||||
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
|
|
||||||
90
.github/workflows/test-custom-executables.yml
vendored
Normal file
90
.github/workflows/test-custom-executables.yml
vendored
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
name: Test Custom Executables
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-custom-executables:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
|
|
||||||
|
- name: Install Bun manually
|
||||||
|
run: |
|
||||||
|
echo "Installing Bun..."
|
||||||
|
curl -fsSL https://bun.sh/install | bash
|
||||||
|
echo "Bun installed at: $HOME/.bun/bin/bun"
|
||||||
|
|
||||||
|
# Verify Bun installation
|
||||||
|
if [ -f "$HOME/.bun/bin/bun" ]; then
|
||||||
|
echo "✅ Bun executable found"
|
||||||
|
$HOME/.bun/bin/bun --version
|
||||||
|
else
|
||||||
|
echo "❌ Bun executable not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install Claude Code manually
|
||||||
|
run: |
|
||||||
|
echo "Installing Claude Code..."
|
||||||
|
curl -fsSL https://claude.ai/install.sh | bash -s latest
|
||||||
|
echo "Claude Code installed at: $HOME/.local/bin/claude"
|
||||||
|
|
||||||
|
# Verify Claude 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 both custom executables
|
||||||
|
id: custom-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
|
||||||
|
path_to_bun_executable: /home/runner/.bun/bin/bun
|
||||||
|
allowed_tools: "LS,Read"
|
||||||
|
timeout_minutes: "3"
|
||||||
|
|
||||||
|
- name: Verify custom executables worked
|
||||||
|
run: |
|
||||||
|
OUTPUT_FILE="${{ steps.custom-test.outputs.execution_file }}"
|
||||||
|
CONCLUSION="${{ steps.custom-test.outputs.conclusion }}"
|
||||||
|
|
||||||
|
echo "Conclusion: $CONCLUSION"
|
||||||
|
echo "Output file: $OUTPUT_FILE"
|
||||||
|
|
||||||
|
if [ "$CONCLUSION" = "success" ]; then
|
||||||
|
echo "✅ Action completed successfully with both custom executables"
|
||||||
|
else
|
||||||
|
echo "❌ Action failed with custom executables"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$OUTPUT_FILE" ] && [ -s "$OUTPUT_FILE" ]; then
|
||||||
|
echo "✅ Execution log file created successfully"
|
||||||
|
if jq . "$OUTPUT_FILE" > /dev/null 2>&1; then
|
||||||
|
echo "✅ Output is valid JSON"
|
||||||
|
# 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 not found or empty"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
15
action.yml
15
action.yml
@@ -122,6 +122,10 @@ inputs:
|
|||||||
description: "Optional path to a custom Claude Code executable. If provided, skips automatic installation and uses this executable instead. WARNING: Using an older version may cause problems if the action begins taking advantage of new Claude Code features. This input is typically not needed unless you're debugging something specific or have unique needs in your environment."
|
description: "Optional path to a custom Claude Code executable. If provided, skips automatic installation and uses this executable instead. WARNING: Using an older version may cause problems if the action begins taking advantage of new Claude Code features. This input is typically not needed unless you're debugging something specific or have unique needs in your environment."
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
|
path_to_bun_executable:
|
||||||
|
description: "Optional path to a custom Bun executable. If provided, skips automatic Bun installation and uses this executable instead. WARNING: Using an incompatible version may cause problems if the action requires specific Bun features. This input is typically not needed unless you're debugging something specific or have unique needs in your environment."
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
execution_file:
|
execution_file:
|
||||||
@@ -135,10 +139,20 @@ runs:
|
|||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Install Bun
|
- name: Install Bun
|
||||||
|
if: inputs.path_to_bun_executable == ''
|
||||||
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # https://github.com/oven-sh/setup-bun/releases/tag/v2.0.2
|
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # https://github.com/oven-sh/setup-bun/releases/tag/v2.0.2
|
||||||
with:
|
with:
|
||||||
bun-version: 1.2.11
|
bun-version: 1.2.11
|
||||||
|
|
||||||
|
- name: Setup Custom Bun Path
|
||||||
|
if: inputs.path_to_bun_executable != ''
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "Using custom Bun executable: ${{ inputs.path_to_bun_executable }}"
|
||||||
|
# Add the directory containing the custom executable to PATH
|
||||||
|
BUN_DIR=$(dirname "${{ inputs.path_to_bun_executable }}")
|
||||||
|
echo "$BUN_DIR" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -228,6 +242,7 @@ runs:
|
|||||||
INPUT_EXPERIMENTAL_SLASH_COMMANDS_DIR: ${{ github.action_path }}/slash-commands
|
INPUT_EXPERIMENTAL_SLASH_COMMANDS_DIR: ${{ github.action_path }}/slash-commands
|
||||||
INPUT_ACTION_INPUTS_PRESENT: ${{ steps.prepare.outputs.action_inputs_present }}
|
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_CLAUDE_CODE_EXECUTABLE: ${{ inputs.path_to_claude_code_executable }}
|
||||||
|
INPUT_PATH_TO_BUN_EXECUTABLE: ${{ inputs.path_to_bun_executable }}
|
||||||
|
|
||||||
# Model configuration
|
# Model configuration
|
||||||
ANTHROPIC_MODEL: ${{ inputs.model || inputs.anthropic_model }}
|
ANTHROPIC_MODEL: ${{ inputs.model || inputs.anthropic_model }}
|
||||||
|
|||||||
@@ -91,6 +91,10 @@ inputs:
|
|||||||
description: "Optional path to a custom Claude Code executable. If provided, skips automatic installation and uses this executable instead. WARNING: Using an older version may cause problems if the action begins taking advantage of new Claude Code features. This input is typically not needed unless you're debugging something specific or have unique needs in your environment."
|
description: "Optional path to a custom Claude Code executable. If provided, skips automatic installation and uses this executable instead. WARNING: Using an older version may cause problems if the action begins taking advantage of new Claude Code features. This input is typically not needed unless you're debugging something specific or have unique needs in your environment."
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
|
path_to_bun_executable:
|
||||||
|
description: "Optional path to a custom Bun executable. If provided, skips automatic Bun installation and uses this executable instead. WARNING: Using an incompatible version may cause problems if the action requires specific Bun features. This input is typically not needed unless you're debugging something specific or have unique needs in your environment."
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
conclusion:
|
conclusion:
|
||||||
@@ -110,10 +114,20 @@ runs:
|
|||||||
cache: ${{ inputs.use_node_cache == 'true' && 'npm' || '' }}
|
cache: ${{ inputs.use_node_cache == 'true' && 'npm' || '' }}
|
||||||
|
|
||||||
- name: Install Bun
|
- name: Install Bun
|
||||||
|
if: inputs.path_to_bun_executable == ''
|
||||||
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # https://github.com/oven-sh/setup-bun/releases/tag/v2.0.2
|
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # https://github.com/oven-sh/setup-bun/releases/tag/v2.0.2
|
||||||
with:
|
with:
|
||||||
bun-version: 1.2.11
|
bun-version: 1.2.11
|
||||||
|
|
||||||
|
- name: Setup Custom Bun Path
|
||||||
|
if: inputs.path_to_bun_executable != ''
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "Using custom Bun executable: ${{ inputs.path_to_bun_executable }}"
|
||||||
|
# Add the directory containing the custom executable to PATH
|
||||||
|
BUN_DIR=$(dirname "${{ inputs.path_to_bun_executable }}")
|
||||||
|
echo "$BUN_DIR" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -161,6 +175,7 @@ runs:
|
|||||||
INPUT_FALLBACK_MODEL: ${{ inputs.fallback_model }}
|
INPUT_FALLBACK_MODEL: ${{ inputs.fallback_model }}
|
||||||
INPUT_EXPERIMENTAL_SLASH_COMMANDS_DIR: ${{ inputs.experimental_slash_commands_dir }}
|
INPUT_EXPERIMENTAL_SLASH_COMMANDS_DIR: ${{ inputs.experimental_slash_commands_dir }}
|
||||||
INPUT_PATH_TO_CLAUDE_CODE_EXECUTABLE: ${{ inputs.path_to_claude_code_executable }}
|
INPUT_PATH_TO_CLAUDE_CODE_EXECUTABLE: ${{ inputs.path_to_claude_code_executable }}
|
||||||
|
INPUT_PATH_TO_BUN_EXECUTABLE: ${{ inputs.path_to_bun_executable }}
|
||||||
|
|
||||||
# Provider configuration
|
# Provider configuration
|
||||||
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
|
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
|
||||||
|
|||||||
Reference in New Issue
Block a user