Workaround OAuth authentication by pretending to use Bedrock

The claude-code-base-action doesn't support OAuth authentication and requires ANTHROPIC_API_KEY when not using cloud providers.

This workaround tells the base action we're using Bedrock when OAuth is specified, which bypasses the API key validation. Since no AWS credentials are provided, Claude Code will fall back to checking for OAuth credentials in the file.

Changes:
- Set use_bedrock=true when anthropic_api_key=='use-oauth'
- Set USE_BEDROCK=true in environment to match
- Pass empty string as anthropic_api_key to base action
This commit is contained in:
claude
2025-07-29 20:13:58 +00:00
parent 4f5899b843
commit de376f197a

View File

@@ -107,7 +107,7 @@ runs:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITEA_API_URL: ${{ env.GITHUB_SERVER_URL }}
# Only set ANTHROPIC_API_KEY if not using OAuth
# Don't set ANTHROPIC_API_KEY when using OAuth
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key != 'use-oauth' && inputs.anthropic_api_key || '' }}
CLAUDE_CREDENTIALS: ${{ inputs.claude_credentials }}
@@ -122,10 +122,11 @@ runs:
timeout_minutes: ${{ inputs.timeout_minutes }}
model: ${{ inputs.model || inputs.anthropic_model }}
mcp_config: ${{ steps.prepare.outputs.mcp_config }}
use_bedrock: ${{ inputs.use_bedrock }}
# Workaround: pretend to use bedrock when using OAuth to bypass validation
use_bedrock: ${{ inputs.use_bedrock || inputs.anthropic_api_key == 'use-oauth' }}
use_vertex: ${{ inputs.use_vertex }}
# Don't pass anthropic_api_key when using OAuth
anthropic_api_key: ${{ inputs.anthropic_api_key != 'use-oauth' && inputs.anthropic_api_key || '' }}
# Pass empty string when using OAuth to avoid base action validation issues
anthropic_api_key: ${{ inputs.anthropic_api_key == 'use-oauth' && '' || inputs.anthropic_api_key }}
env:
# Core configuration
PROMPT_FILE: /tmp/claude-prompts/claude-prompt.txt
@@ -135,9 +136,10 @@ runs:
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 }}
# Workaround: pretend to use bedrock when using OAuth to bypass validation
USE_BEDROCK: ${{ inputs.use_bedrock || inputs.anthropic_api_key == 'use-oauth' }}
USE_VERTEX: ${{ inputs.use_vertex }}
# Only set ANTHROPIC_API_KEY if not using OAuth
# Don't set ANTHROPIC_API_KEY when using OAuth
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key != 'use-oauth' && inputs.anthropic_api_key || '' }}
CLAUDE_CREDENTIALS: ${{ inputs.claude_credentials }}