Describe the bug
The claude-code-action@v1 clears the CLAUDE_CODE_OAUTH_TOKEN environment variable after the preparation phase, causing the base-action execution to fail with an authentication error even though the token was properly provided.
To Reproduce
Steps to reproduce the behavior:
- Configure the action with CLAUDE_CODE_OAUTH_TOKEN in the env section:
- uses: anthropics/claude-code-action@v1
env:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
with:
prompt: |
Review this PR…
- Run the workflow
- Observe that it fails with:
Environment variable validation failed: Either ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN is required
Expected behavior
The CLAUDE_CODE_OAUTH_TOKEN should remain available throughout the entire action execution, allowing the action to authenticate successfully using the OAuth token.
Actual Behavior
The token is present during the prepare phase but gets cleared before the base-action execution phase:
# Prepare phase (working):
env:
CLAUDE_CODE_OAUTH_TOKEN: ***
# Base-action execution phase (broken):
env:
CLAUDE_CODE_OAUTH_TOKEN: # <--- Empty!
This causes the action to fail with:
Error: Environment variable validation failed:
- Either ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN is required when using direct Anthropic API.
Screenshots
If applicable, add screenshots to help explain your problem.
Workflow yml file
If it's not sensitive, consider including a paste of your full Claude workflow.yml file.
API Provider
[ ] Anthropic First-Party API (default)
[ ] AWS Bedrock
[ ] GCP Vertex
Additional context
Action version: anthropics/claude-code-action@v1 (SHA: 8a1c437)
Runner: ubuntu-latest (Ubuntu 24.04.3)
Bun version: 1.2.11
Describe the bug
The claude-code-action@v1 clears the CLAUDE_CODE_OAUTH_TOKEN environment variable after the preparation phase, causing the base-action execution to fail with an authentication error even though the token was properly provided.
To Reproduce
Steps to reproduce the behavior:
Environment variable validation failed: Either ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN is requiredExpected behavior
The
CLAUDE_CODE_OAUTH_TOKENshould remain available throughout the entire action execution, allowing the action to authenticate successfully using the OAuth token.Actual Behavior
The token is present during the prepare phase but gets cleared before the base-action execution phase:
This causes the action to fail with:
Error: Environment variable validation failed:
Screenshots
If applicable, add screenshots to help explain your problem.
Workflow yml file
If it's not sensitive, consider including a paste of your full Claude workflow.yml file.
API Provider
[ ] Anthropic First-Party API (default)
[ ] AWS Bedrock
[ ] GCP Vertex
Additional context
Action version: anthropics/claude-code-action@v1 (SHA: 8a1c437)
Runner: ubuntu-latest (Ubuntu 24.04.3)
Bun version: 1.2.11