Update claude-code-base-action to latest version v0.0.48
The version we were using (v0.0.24) may not have proper OAuth support. Updating to the latest version to see if OAuth handling has been improved.
This commit is contained in:
105
action.yml
105
action.yml
@@ -107,78 +107,61 @@ runs:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
||||
GITEA_API_URL: ${{ env.GITHUB_SERVER_URL }}
|
||||
# Don't set ANTHROPIC_API_KEY when using OAuth
|
||||
# Only set ANTHROPIC_API_KEY if not using OAuth
|
||||
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key != 'use-oauth' && inputs.anthropic_api_key || '' }}
|
||||
CLAUDE_CREDENTIALS: ${{ inputs.claude_credentials }}
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.prepare.outputs.contains_trigger == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Install Claude Code
|
||||
if: steps.prepare.outputs.contains_trigger == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Installing Claude Code..."
|
||||
npm install -g @anthropic-ai/claude-code@latest
|
||||
|
||||
- name: Run Claude Code
|
||||
id: claude-code
|
||||
if: steps.prepare.outputs.contains_trigger == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
# Run Claude Code directly when using OAuth
|
||||
if [ "${{ inputs.anthropic_api_key }}" = "use-oauth" ]; then
|
||||
echo "Running Claude Code with OAuth authentication"
|
||||
# Export empty ANTHROPIC_API_KEY to ensure OAuth credentials are used
|
||||
export ANTHROPIC_API_KEY=""
|
||||
else
|
||||
echo "Running Claude Code with API key authentication"
|
||||
export ANTHROPIC_API_KEY="${{ inputs.anthropic_api_key }}"
|
||||
fi
|
||||
|
||||
# Set up other environment variables
|
||||
export ALLOWED_TOOLS="${{ env.ALLOWED_TOOLS }}"
|
||||
export DISALLOWED_TOOLS="${{ env.DISALLOWED_TOOLS }}"
|
||||
export MCP_CONFIG='${{ steps.prepare.outputs.mcp_config }}'
|
||||
export MODEL="${{ inputs.model || inputs.anthropic_model }}"
|
||||
export ANTHROPIC_MODEL="${{ inputs.model || inputs.anthropic_model }}"
|
||||
export TIMEOUT_MINUTES="${{ inputs.timeout_minutes }}"
|
||||
export PROMPT_FILE="/tmp/claude-prompts/claude-prompt.txt"
|
||||
|
||||
# Set up MCP configuration
|
||||
mkdir -p ~/.config/claude-code
|
||||
echo "$MCP_CONFIG" > ~/.config/claude-code/mcp-config.json
|
||||
|
||||
# Run Claude Code
|
||||
OUTPUT_FILE="/tmp/claude-code-output-$(date +%s).json"
|
||||
if claude-code --prompt-file "$PROMPT_FILE" \
|
||||
--output-file "$OUTPUT_FILE" \
|
||||
--allowed-tools "$ALLOWED_TOOLS" \
|
||||
--disallowed-tools "$DISALLOWED_TOOLS" \
|
||||
--model "$MODEL" \
|
||||
--timeout "${TIMEOUT_MINUTES}m" \
|
||||
--mcp-config ~/.config/claude-code/mcp-config.json; then
|
||||
echo "Claude Code execution succeeded"
|
||||
echo "execution_file=$OUTPUT_FILE" >> $GITHUB_OUTPUT
|
||||
echo "conclusion=success" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Claude Code execution failed"
|
||||
echo "conclusion=failure" >> $GITHUB_OUTPUT
|
||||
exit 1
|
||||
fi
|
||||
uses: anthropics/claude-code-base-action@v0.0.48
|
||||
with:
|
||||
prompt_file: /tmp/claude-prompts/claude-prompt.txt
|
||||
allowed_tools: ${{ env.ALLOWED_TOOLS }}
|
||||
disallowed_tools: ${{ env.DISALLOWED_TOOLS }}
|
||||
timeout_minutes: ${{ inputs.timeout_minutes }}
|
||||
model: ${{ inputs.model || inputs.anthropic_model }}
|
||||
mcp_config: ${{ steps.prepare.outputs.mcp_config }}
|
||||
use_bedrock: ${{ inputs.use_bedrock }}
|
||||
use_vertex: ${{ inputs.use_vertex }}
|
||||
anthropic_api_key: ${{ inputs.anthropic_api_key }}
|
||||
env:
|
||||
# Core configuration
|
||||
PROMPT_FILE: /tmp/claude-prompts/claude-prompt.txt
|
||||
ALLOWED_TOOLS: ${{ env.ALLOWED_TOOLS }}
|
||||
DISALLOWED_TOOLS: ${{ env.DISALLOWED_TOOLS }}
|
||||
TIMEOUT_MINUTES: ${{ inputs.timeout_minutes }}
|
||||
MODEL: ${{ inputs.model || inputs.anthropic_model }}
|
||||
ANTHROPIC_MODEL: ${{ inputs.model || inputs.anthropic_model }}
|
||||
MCP_CONFIG: ${{ steps.prepare.outputs.mcp_config }}
|
||||
USE_BEDROCK: ${{ inputs.use_bedrock }}
|
||||
USE_VERTEX: ${{ inputs.use_vertex }}
|
||||
# Only set ANTHROPIC_API_KEY if not using OAuth
|
||||
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key != 'use-oauth' && inputs.anthropic_api_key || '' }}
|
||||
CLAUDE_CREDENTIALS: ${{ inputs.claude_credentials }}
|
||||
|
||||
# GitHub token for repository access
|
||||
GITHUB_TOKEN: ${{ steps.prepare.outputs.GITHUB_TOKEN }}
|
||||
GITEA_API_URL: ${{ env.GITHUB_SERVER_URL }}
|
||||
|
||||
# Git configuration for Claude Code
|
||||
GIT_AUTHOR_NAME: ${{ inputs.claude_git_name }}
|
||||
GIT_AUTHOR_EMAIL: ${{ inputs.claude_git_email }}
|
||||
GIT_COMMITTER_NAME: ${{ inputs.claude_git_name }}
|
||||
GIT_COMMITTER_EMAIL: ${{ inputs.claude_git_email }}
|
||||
# Git configuration
|
||||
CLAUDE_GIT_NAME: ${{ inputs.claude_git_name }}
|
||||
CLAUDE_GIT_EMAIL: ${{ inputs.claude_git_email }}
|
||||
|
||||
# Provider configuration (for future cloud provider support)
|
||||
ANTHROPIC_BASE_URL: ${{ env.ANTHROPIC_BASE_URL }}
|
||||
AWS_REGION: ${{ env.AWS_REGION }}
|
||||
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
|
||||
ANTHROPIC_BEDROCK_BASE_URL: ${{ env.ANTHROPIC_BEDROCK_BASE_URL }}
|
||||
ANTHROPIC_VERTEX_PROJECT_ID: ${{ env.ANTHROPIC_VERTEX_PROJECT_ID }}
|
||||
CLOUD_ML_REGION: ${{ env.CLOUD_ML_REGION }}
|
||||
GOOGLE_APPLICATION_CREDENTIALS: ${{ env.GOOGLE_APPLICATION_CREDENTIALS }}
|
||||
ANTHROPIC_VERTEX_BASE_URL: ${{ env.ANTHROPIC_VERTEX_BASE_URL }}
|
||||
VERTEX_REGION_CLAUDE_3_5_HAIKU: ${{ env.VERTEX_REGION_CLAUDE_3_5_HAIKU }}
|
||||
VERTEX_REGION_CLAUDE_3_5_SONNET: ${{ env.VERTEX_REGION_CLAUDE_3_5_SONNET }}
|
||||
VERTEX_REGION_CLAUDE_3_7_SONNET: ${{ env.VERTEX_REGION_CLAUDE_3_7_SONNET }}
|
||||
|
||||
- name: Update comment with job link
|
||||
if: steps.prepare.outputs.contains_trigger == 'true' && steps.prepare.outputs.claude_comment_id && always()
|
||||
|
||||
Reference in New Issue
Block a user