Add Claude Code GitHub Workflow (#190)
This commit is contained in:
76
.github/workflows/claude-code-review.yml
vendored
Normal file
76
.github/workflows/claude-code-review.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
name: Claude Code Review
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize]
|
||||||
|
# Optional: Only run on specific file changes
|
||||||
|
# paths:
|
||||||
|
# - "src/**/*.ts"
|
||||||
|
# - "src/**/*.tsx"
|
||||||
|
# - "src/**/*.js"
|
||||||
|
# - "src/**/*.jsx"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
claude-review:
|
||||||
|
# Optional: Filter by PR author
|
||||||
|
# if: |
|
||||||
|
# github.event.pull_request.user.login == 'external-contributor' ||
|
||||||
|
# github.event.pull_request.user.login == 'new-developer' ||
|
||||||
|
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
issues: read
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Run Claude Code Review
|
||||||
|
id: claude-review
|
||||||
|
uses: anthropics/claude-code-action@beta
|
||||||
|
with:
|
||||||
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||||
|
|
||||||
|
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
|
||||||
|
# model: "claude-opus-4-20250514"
|
||||||
|
|
||||||
|
# Direct prompt for automated review (no @claude mention needed)
|
||||||
|
direct_prompt: |
|
||||||
|
Please review this pull request and provide feedback on:
|
||||||
|
- Code quality and best practices
|
||||||
|
- Potential bugs or issues
|
||||||
|
- Performance considerations
|
||||||
|
- Security concerns
|
||||||
|
|
||||||
|
Be constructive and helpful in your feedback.
|
||||||
|
|
||||||
|
# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
|
||||||
|
# use_sticky_comment: true
|
||||||
|
|
||||||
|
# Optional: Customize review based on file types
|
||||||
|
# direct_prompt: |
|
||||||
|
# Review this PR focusing on:
|
||||||
|
# - For TypeScript files: Type safety and proper interface usage
|
||||||
|
# - For API endpoints: Security, input validation, and error handling
|
||||||
|
# - For React components: Performance, accessibility, and best practices
|
||||||
|
# - For tests: Coverage, edge cases, and test quality
|
||||||
|
|
||||||
|
# Optional: Different prompts for different authors
|
||||||
|
# direct_prompt: |
|
||||||
|
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
|
||||||
|
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
|
||||||
|
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
|
||||||
|
|
||||||
|
# Optional: Add specific tools for running tests or linting
|
||||||
|
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
|
||||||
|
|
||||||
|
# Optional: Skip review for certain conditions
|
||||||
|
# if: |
|
||||||
|
# !contains(github.event.pull_request.title, '[skip-review]') &&
|
||||||
|
# !contains(github.event.pull_request.title, '[WIP]')
|
61
.github/workflows/claude.yml
vendored
Normal file
61
.github/workflows/claude.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
name: Claude Code
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
pull_request_review_comment:
|
||||||
|
types: [created]
|
||||||
|
issues:
|
||||||
|
types: [opened, assigned]
|
||||||
|
pull_request_review:
|
||||||
|
types: [submitted]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
claude:
|
||||||
|
if: |
|
||||||
|
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||||
|
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||||
|
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
||||||
|
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
issues: read
|
||||||
|
id-token: write
|
||||||
|
actions: read # Required for Claude to read CI results on PRs
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Run Claude Code
|
||||||
|
id: claude
|
||||||
|
uses: anthropics/claude-code-action@beta
|
||||||
|
with:
|
||||||
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||||
|
|
||||||
|
# This is an optional setting that allows Claude to read CI results on PRs
|
||||||
|
additional_permissions: |
|
||||||
|
actions: read
|
||||||
|
|
||||||
|
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
|
||||||
|
# model: "claude-opus-4-20250514"
|
||||||
|
|
||||||
|
# Optional: Customize the trigger phrase (default: @claude)
|
||||||
|
# trigger_phrase: "/claude"
|
||||||
|
|
||||||
|
# Optional: Trigger when specific user is assigned to an issue
|
||||||
|
# assignee_trigger: "claude-bot"
|
||||||
|
|
||||||
|
# Optional: Allow Claude to run specific commands
|
||||||
|
# allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
|
||||||
|
|
||||||
|
# Optional: Add custom instructions for Claude to customize its behavior for your project
|
||||||
|
custom_instructions: |
|
||||||
|
follow rules from CLAUDE.md
|
||||||
|
|
||||||
|
# Optional: Custom environment variables for Claude
|
||||||
|
# claude_env: |
|
||||||
|
# NODE_ENV: test
|
36
CLAUDE.md
36
CLAUDE.md
@@ -1,7 +1,9 @@
|
|||||||
# Unsend Project Guidelines
|
# CLAUDE.md
|
||||||
|
|
||||||
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
- **Build**: `pnpm build` (specific: `pnpm build:web`, `pnpm build:editor`)
|
- **Build**: `pnpm build` (specific: `pnpm build:web`, `pnpm build:editor`, `pnpm build:marketing`)
|
||||||
- **Lint**: `pnpm lint`
|
- **Lint**: `pnpm lint`
|
||||||
- **Dev**: `pnpm dev` (or `pnpm d` for setup + dev)
|
- **Dev**: `pnpm dev` (or `pnpm d` for setup + dev)
|
||||||
- **DB**: `pnpm db:migrate-dev`, `pnpm db:studio`, `pnpm db:push`
|
- **DB**: `pnpm db:migrate-dev`, `pnpm db:studio`, `pnpm db:push`
|
||||||
@@ -19,3 +21,33 @@
|
|||||||
- **API**: Use tRPC for internal, Hono for public API endpoints
|
- **API**: Use tRPC for internal, Hono for public API endpoints
|
||||||
|
|
||||||
Follow Vercel style guides with strict TypeScript. Be thoughtful, write readable code over premature optimization.
|
Follow Vercel style guides with strict TypeScript. Be thoughtful, write readable code over premature optimization.
|
||||||
|
|
||||||
|
## Architecture Overview
|
||||||
|
|
||||||
|
Unsend is an open-source email sending infrastructure built as a monorepo with the following structure:
|
||||||
|
|
||||||
|
### Core Applications
|
||||||
|
- **web** (`apps/web`): Main Next.js dashboard application with tRPC API, Prisma ORM, authentication
|
||||||
|
- **marketing** (`apps/marketing`): Marketing website built with Next.js
|
||||||
|
- **smtp-server** (`apps/smtp-server`): SMTP server implementation
|
||||||
|
- **docs** (`apps/docs`): Documentation using Mintlify
|
||||||
|
|
||||||
|
### Shared Packages
|
||||||
|
- **email-editor** (`packages/email-editor`): Rich email editor using TipTap, JSX Email
|
||||||
|
- **ui** (`packages/ui`): Shared UI components using shadcn/ui and Tailwind
|
||||||
|
- **sdk** (`packages/sdk`): Client SDK for Unsend API
|
||||||
|
- **eslint-config**, **typescript-config**, **tailwind-config**: Shared configurations
|
||||||
|
|
||||||
|
### Key Technologies
|
||||||
|
- **Frontend**: Next.js 15, React 19, Tailwind CSS, shadcn/ui, Framer Motion
|
||||||
|
- **Backend**: tRPC, Prisma, PostgreSQL, Redis (BullMQ queues)
|
||||||
|
- **Email**: AWS SES, JSX Email, custom email editor
|
||||||
|
- **Auth**: NextAuth.js with GitHub/Google providers
|
||||||
|
- **API**: Hono for public REST API with OpenAPI/Swagger
|
||||||
|
- **Infrastructure**: Docker, Railway deployment ready
|
||||||
|
|
||||||
|
### Development Workflow
|
||||||
|
- Uses Turbo for monorepo builds and development
|
||||||
|
- Environment setup with `pnpm dx` (installs deps, starts Docker, runs migrations)
|
||||||
|
- Database operations prefixed with `pnpm db:`
|
||||||
|
- Each package has independent linting and building
|
Reference in New Issue
Block a user