Purpose: GitHub Action that creates and manages Coder Agents chats for GitHub users with automated issue commenting support.
Key Difference from create-task-action: This action targets the Coder Agents Chat API (/api/experimental/chats) instead of the Tasks API. Agents purposefully does NOT expose template selection — it either auto-provisions a workspace or uses an existing one.
Tech Stack:
- Runtime: Bun (JavaScript/TypeScript runtime & bundler)
- Language: TypeScript with strict mode enabled
- Validation: Zod for runtime schema validation
- Testing: Bun's built-in test runner
- GitHub Integration: @actions/core, @actions/github, @octokit/rest
- Formatting/Linting: Biome
GitHub Event (issue created/labeled)
↓
index.ts (Entry Point)
↓
Parse & Validate Inputs (schemas.ts)
↓
Initialize Clients (CoderClient, Octokit)
↓
CoderAgentChatAction.run() (action.ts)
↓
├─ Get Coder user by GitHub ID (or use provided username)
├─ Parse GitHub issue URL
├─ Check if existing-chat-id provided
│ ├─ YES: Send message to existing chat
│ └─ NO: Look up existing chat by reuse labels (unless force-new-chat)
│ ├─ Match: Send message to reused chat
│ └─ No match: Create new chat (Agents auto-provisions workspace)
└─ Comment on GitHub issue with chat URL
- No Template Selection: Agents auto-chooses workspace infrastructure
- Optional Workspace ID: Can pin to existing workspace via
workspace-id - Chat API: Uses
/api/experimental/chats(not Tasks API) - Dependency Injection: All external dependencies injected for testability
- Schema Validation: Zod schemas ensure type safety at runtime
- index.ts - Entry point, parses GHA inputs, initializes clients, runs action
- action.ts - Core business logic: user resolution, chat creation, issue commenting
- coder-client.ts - Coder API client for Chat endpoints + user lookup
- schemas.ts - Zod schemas for action inputs and outputs
- test-helpers.ts - Mock objects, helper factories, test data
- action.test.ts - Tests for CoderAgentChatAction
- coder-client.test.ts - Tests for RealCoderClient API interactions
- schemas.test.ts - Tests for input/output schema validation
# Install dependencies
bun install
# Run tests
bun test
# Type checking
bun run typecheck
# Lint
bun run lint
# Format code
bun run format
# Build for production
bun run build- Stable API:
GET /api/v2/users?q=github_com_user_id:{id}- User lookup
- Experimental API:
POST /api/experimental/chats- Create chatPOST /api/experimental/chats/{id}/messages- Send messageGET /api/experimental/chats/{id}- Get chatGET /api/experimental/chats- List chats