Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ inputs:
claude_code_oauth_token:
description: "Claude Code OAuth token (alternative to anthropic_api_key)"
required: false
anthropic_auth_token:
description: "Anthropic auth token for third-party API providers like LiteLLM proxy (alternative to anthropic_api_key)"
required: false
github_token:
description: "GitHub token with repo and pull request permissions (optional if using GitHub App)"
required: false
Expand Down Expand Up @@ -233,6 +236,7 @@ runs:
# Provider configuration
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude_code_oauth_token }}
ANTHROPIC_AUTH_TOKEN: ${{ inputs.anthropic_auth_token }}
ANTHROPIC_BASE_URL: ${{ env.ANTHROPIC_BASE_URL }}
ANTHROPIC_CUSTOM_HEADERS: ${{ env.ANTHROPIC_CUSTOM_HEADERS }}
CLAUDE_CODE_USE_BEDROCK: ${{ inputs.use_bedrock == 'true' && '1' || '' }}
Expand Down
5 changes: 5 additions & 0 deletions base-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ inputs:
description: "Claude Code OAuth token (alternative to anthropic_api_key)"
required: false
default: ""
anthropic_auth_token:
description: "Anthropic auth token for third-party API providers like LiteLLM proxy (alternative to anthropic_api_key)"
required: false
default: ""
use_bedrock:
description: "Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API"
required: false
Expand Down Expand Up @@ -175,6 +179,7 @@ runs:
# Provider configuration
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude_code_oauth_token }}
ANTHROPIC_AUTH_TOKEN: ${{ inputs.anthropic_auth_token }}
ANTHROPIC_BASE_URL: ${{ env.ANTHROPIC_BASE_URL }}
ANTHROPIC_CUSTOM_HEADERS: ${{ env.ANTHROPIC_CUSTOM_HEADERS }}
# Only set provider flags if explicitly true, since any value (including "false") is truthy
Expand Down
5 changes: 3 additions & 2 deletions base-action/src/validate-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export function validateEnvironmentVariables() {
const useFoundry = process.env.CLAUDE_CODE_USE_FOUNDRY === "1";
const anthropicApiKey = process.env.ANTHROPIC_API_KEY;
const claudeCodeOAuthToken = process.env.CLAUDE_CODE_OAUTH_TOKEN;
const anthropicAuthToken = process.env.ANTHROPIC_AUTH_TOKEN;

const errors: string[] = [];

Expand All @@ -20,9 +21,9 @@ export function validateEnvironmentVariables() {
}

if (!useBedrock && !useVertex && !useFoundry) {
if (!anthropicApiKey && !claudeCodeOAuthToken) {
if (!anthropicApiKey && !claudeCodeOAuthToken && !anthropicAuthToken) {
errors.push(
"Either ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN is required when using direct Anthropic API.",
"Either ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, or ANTHROPIC_AUTH_TOKEN is required when using direct Anthropic API.",
);
}
} else if (useBedrock) {
Expand Down
11 changes: 9 additions & 2 deletions base-action/test/validate-env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe("validateEnvironmentVariables", () => {
delete process.env.ANTHROPIC_VERTEX_BASE_URL;
delete process.env.ANTHROPIC_FOUNDRY_RESOURCE;
delete process.env.ANTHROPIC_FOUNDRY_BASE_URL;
delete process.env.ANTHROPIC_AUTH_TOKEN;
});

afterEach(() => {
Expand All @@ -40,9 +41,15 @@ describe("validateEnvironmentVariables", () => {
expect(() => validateEnvironmentVariables()).not.toThrow();
});

test("should fail when ANTHROPIC_API_KEY is missing", () => {
test("should pass when ANTHROPIC_AUTH_TOKEN is provided", () => {
process.env.ANTHROPIC_AUTH_TOKEN = "test-auth-token";

expect(() => validateEnvironmentVariables()).not.toThrow();
});

test("should fail when no auth token is provided", () => {
expect(() => validateEnvironmentVariables()).toThrow(
"Either ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN is required when using direct Anthropic API.",
"Either ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, or ANTHROPIC_AUTH_TOKEN is required when using direct Anthropic API.",
);
});
});
Expand Down