https://github.com/pleaseai/setup-claude-code
https://github.com/pleaseai/setup-claude-code
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pleaseai/setup-claude-code
- Owner: pleaseai
- License: mit
- Created: 2025-10-23T10:59:33.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2026-01-13T08:41:30.000Z (5 months ago)
- Last Synced: 2026-01-13T10:47:07.756Z (5 months ago)
- Language: TypeScript
- Size: 1.2 MB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Setup Claude Code
[](https://github.com/pleaseai/setup-claude-code/actions/workflows/test.yml)
[](https://github.com/pleaseai/setup-claude-code/actions/workflows/integration.yml)
[](https://codecov.io/gh/pleaseai/setup-claude-code)
[](https://github.com/antfu/eslint-config)
Install [Claude Code CLI](https://claude.ai/code) in your GitHub Actions workflows with built-in caching support.
## Features
- โก **Fast**: Built-in caching reduces installation time
- ๐ **Secure**: Verifies binary checksums via SHA256
- ๐งช **Tested**: Comprehensive unit and integration tests
- ๐ฆ **TypeScript**: Type-safe, maintainable codebase
- ๐ **Node 24**: Uses the latest Node.js runtime
- ๐ **Plugins**: Install marketplace and plugins in one step
## Usage
### Basic Example
```yaml
name: CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pleaseai/setup-claude-code@v1
with:
version: latest
- run: claude --version
```
### With Specific Version
```yaml
- uses: pleaseai/setup-claude-code@v1
with:
version: 2.0.25 # Install specific version number
```
### With Stable Version
```yaml
- uses: pleaseai/setup-claude-code@v1
with:
version: stable # Install stable version (recommended for production)
```
### Using Outputs
```yaml
- uses: pleaseai/setup-claude-code@v1
id: setup-claude
with:
version: latest
- run: |
echo "Cache hit: ${{ steps.setup-claude.outputs.cache-hit }}"
echo "Version: ${{ steps.setup-claude.outputs.version }}"
echo "Path: ${{ steps.setup-claude.outputs.claude-path }}"
```
### Installing Plugins
#### Single Marketplace with Comma-Separated Plugins
```yaml
- uses: pleaseai/setup-claude-code@v1
with:
marketplaces: chatbot-pf/claude-plugins
plugins: dev-tools@passionfactory,pr-review-toolkit@passionfactory
```
#### Private Repositories
The action automatically uses `${{ github.token }}` for git authentication. For private repositories with custom access requirements, you can provide a Personal Access Token (PAT):
```yaml
- uses: pleaseai/setup-claude-code@v1
with:
github_token: ${{ secrets.MY_PAT }} # Optional: only needed for custom access
marketplaces: your-org/private-plugins
plugins: private-plugin@your-org
```
#### Multiple Marketplaces with Multiline Format
```yaml
- uses: pleaseai/setup-claude-code@v1
with:
marketplaces: |
chatbot-pf/claude-plugins
company/private-plugins
https://gitlab.com/org/plugins.git
plugins: |
dev-tools@passionfactory
pr-review-toolkit@passionfactory
custom-plugin@company
```
#### From Various Sources
```yaml
- uses: pleaseai/setup-claude-code@v1
with:
marketplaces: |
owner/repo
https://gitlab.com/company/plugins.git
https://url.of/marketplace.json
./local/marketplace
plugins: plugin1,plugin2,plugin3
```
#### Note on Marketplaces
**Important**: Claude Code CLI does not have a default marketplace. You must add at least one marketplace before installing plugins. The `marketplaces` input is required if you want to use the `plugins` input.
Example with marketplace and plugins together:
```yaml
- uses: pleaseai/setup-claude-code@v1
with:
marketplaces: chatbot-pf/claude-plugins
plugins: |
dev-tools@passionfactory
pr-review-toolkit@passionfactory
```
## Inputs
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `version` | Claude Code version to install. Options: `stable` (recommended), `latest`, or specific version number (e.g., `2.0.25`) | No | `latest` |
| `github_token` | GitHub token for accessing plugin repositories. Automatically defaults to `${{ github.token }}`. Provide a custom PAT only if you need special access permissions. | No | `${{ github.token }}` |
| `marketplaces` | Plugin marketplace sources. Supports: GitHub (`owner/repo`), Git URL, local path, or remote URL. Can be comma-separated or newline-separated (with `\|`) for multiple marketplaces. **Required if installing plugins.** | No | - |
| `plugins` | List of plugins to install. Can be comma-separated or newline-separated (with `\|`). **Requires `marketplaces` to be specified.** | No | - |
## Outputs
| Output | Description |
|--------|-------------|
| `cache-hit` | Whether cache was restored (`true` or `false`) |
| `version` | Installed Claude Code version |
| `claude-path` | Absolute path to claude executable |
| `marketplaces_added` | Number of marketplaces added or updated |
| `plugins_installed` | Comma-separated list of successfully installed plugins |
## Caching
This action automatically caches Claude Code installations to speed up your workflows:
- **Latest version**: Daily cache rotation (cache key includes date)
- **Specific versions**: Permanent cache (cache key is version-specific)
Cache keys follow the pattern:
- Latest: `claude-code-v2-{os}-latest-{date}`
- Versioned: `claude-code-v2-{os}-{version}`
## Platform Support
- โ
Linux (x64, arm64)
- โ
Linux with musl (x64, arm64) - Alpine, etc.
- โ
macOS (x64, arm64)
- โณ Windows (x64) - Planned (see [#3](https://github.com/pleaseai/setup-claude-code/issues/3))
## Development
This action is built with TypeScript and uses modern tooling:
- **Runtime**: Node.js 24
- **Testing**: Vitest 3.x
- **Linting**: @antfu/eslint-config
- **Build**: @vercel/ncc
### Setup
```bash
# Install dependencies
npm install
# Run tests
npm test
# Build
npm run build
```
### Commands
```bash
npm test # Run tests in watch mode
npm run test:ci # Run tests once with coverage
npm run lint # Check code style
npm run lint:fix # Auto-fix style issues
npm run typecheck # Type check without emitting
npm run build # Compile to dist/index.js
```
### Making Changes
1. Modify TypeScript source in `src/`
2. Write/update tests in `test/`
3. Run tests: `npm test`
4. Build: `npm run build`
5. Commit both source and compiled `dist/` folder
**Important**: Always commit the `dist/` folder. GitHub Actions cannot compile TypeScript at runtime.
## Architecture
```
src/
โโโ main.ts # Entry point
โโโ installer.ts # Download, verify, install logic
โโโ cache.ts # Cache key generation and operations
โโโ utils.ts # Platform detection, PATH management
test/
โโโ utils.test.ts
โโโ cache.test.ts
.github/workflows/
โโโ test.yml # CI: lint, test, build
โโโ integration.yml # E2E: actual installation test
```
## License
MIT
## Author
Minsu Lee ([@amondnet](https://github.com/amondnet))