mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
feat: integrate claude-code-base-action as local subaction (#285)
* feat: integrate claude-code-base-action as local subaction
- Copy claude-code-base-action into base-action/ directory
- Update action.yml to reference ./base-action instead of external repo
- Preserve complete base action structure for future refactoring
This eliminates the external dependency while maintaining modularity.
* feat: consolidate CI workflows and add version bump workflow
- Move base-action test workflows to main .github/workflows/
- Update workflow references to use ./base-action
- Add CI jobs for base-action (test, typecheck, prettier)
- Add bump-claude-code-version workflow for base-action
- Remove redundant .github directory from base-action
This consolidates all CI workflows in one place while maintaining
full test coverage for both the main action and base-action.
* tsc
* copy again
* fix tests
* fix: use absolute path for base-action reference
Replace relative path ./base-action with ${{ github.action_path }}/base-action
to ensure the action works correctly when used in other repositories.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: inline base-action execution to support usage in other repos
Replace uses: ./base-action with direct shell execution since GitHub Actions
doesn't support dynamic paths in composite actions. This ensures the action
works correctly when used in other repositories.
Changes:
- Install Claude Code globally before execution
- Run base-action's index.ts directly with bun
- Pass all required INPUT_* environment variables
- Maintain base-action for future separate publishing
🤖 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:
60
base-action/CLAUDE.md
Normal file
60
base-action/CLAUDE.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# CLAUDE.md
|
||||
|
||||
## Common Commands
|
||||
|
||||
### Development Commands
|
||||
|
||||
- Build/Type check: `bun run typecheck`
|
||||
- Format code: `bun run format`
|
||||
- Check formatting: `bun run format:check`
|
||||
- Run tests: `bun test`
|
||||
- Install dependencies: `bun install`
|
||||
|
||||
### Action Testing
|
||||
|
||||
- Test action locally: `./test-local.sh`
|
||||
- Test specific file: `bun test test/prepare-prompt.test.ts`
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
This is a GitHub Action that allows running Claude Code within GitHub workflows. The action consists of:
|
||||
|
||||
### Core Components
|
||||
|
||||
1. **Action Definition** (`action.yml`): Defines inputs, outputs, and the composite action steps
|
||||
2. **Prompt Preparation** (`src/index.ts`): Runs Claude Code with specified arguments
|
||||
|
||||
### Key Design Patterns
|
||||
|
||||
- Uses Bun runtime for development and execution
|
||||
- Named pipes for IPC between prompt input and Claude process
|
||||
- JSON streaming output format for execution logs
|
||||
- Composite action pattern to orchestrate multiple steps
|
||||
- Provider-agnostic design supporting Anthropic API, AWS Bedrock, and Google Vertex AI
|
||||
|
||||
## Provider Authentication
|
||||
|
||||
1. **Anthropic API** (default): Requires API key via `anthropic_api_key` input
|
||||
2. **AWS Bedrock**: Uses OIDC authentication when `use_bedrock: true`
|
||||
3. **Google Vertex AI**: Uses OIDC authentication when `use_vertex: true`
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Local Testing
|
||||
|
||||
- Use `act` tool to run GitHub Actions workflows locally
|
||||
- `test-local.sh` script automates local testing setup
|
||||
- Requires `ANTHROPIC_API_KEY` environment variable
|
||||
|
||||
### Test Structure
|
||||
|
||||
- Unit tests for configuration logic
|
||||
- Integration tests for prompt preparation
|
||||
- Full workflow tests in `.github/workflows/test-action.yml`
|
||||
|
||||
## Important Technical Details
|
||||
|
||||
- Uses `mkfifo` to create named pipes for prompt input
|
||||
- Outputs execution logs as JSON to `/tmp/claude-execution-output.json`
|
||||
- Timeout enforcement via `timeout` command wrapper
|
||||
- Strict TypeScript configuration with Bun-specific settings
|
||||
Reference in New Issue
Block a user