@@ -2,33 +2,64 @@ name: Claude Code Review
22
33on :
44 pull_request :
5- types : [opened, synchronize]
6- # Optional: Only run on specific file changes
7- # paths:
8- # - "src/**/*.ts"
9- # - "src/**/*.tsx"
10- # - "src/**/*.js"
11- # - "src/**/*.jsx"
5+ types : [opened]
6+ issue_comment :
7+ types : [created]
128
139jobs :
10+ post-instructions :
11+ # Only run on new PR creation
12+ if : github.event_name == 'pull_request' && github.event.action == 'opened'
13+ runs-on : ubuntu-latest
14+ permissions :
15+ pull-requests : write
16+
17+ steps :
18+ - name : Post instruction comment
19+ uses : actions/github-script@v7
20+ with :
21+ script : |
22+ await github.rest.issues.createComment({
23+ owner: context.repo.owner,
24+ repo: context.repo.repo,
25+ issue_number: context.payload.pull_request.number,
26+ body: 'Hey, leave a @claude-review comment below and I\'ll do a code review!'
27+ });
28+
1429 claude-review :
15- # Optional: Filter by PR author
16- # if: |
17- # github.event.pull_request.user.login == 'external-contributor' ||
18- # github.event.pull_request.user.login == 'new-developer' ||
19- # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20-
30+ # Only run when someone comments "@claude-review" on a PR
31+ if : |
32+ github.event.issue.pull_request &&
33+ contains(github.event.comment.body, '@claude-review')
34+
2135 runs-on : ubuntu-latest
2236 permissions :
2337 contents : read
2438 pull-requests : read
2539 issues : read
2640 id-token : write
27-
41+
2842 steps :
43+ # Get PR details to checkout the correct commit
44+ - name : Get PR details
45+ uses : actions/github-script@v7
46+ id : pr
47+ with :
48+ script : |
49+ const { data: pullRequest } = await github.rest.pulls.get({
50+ owner: context.repo.owner,
51+ repo: context.repo.repo,
52+ pull_number: context.issue.number
53+ });
54+ return {
55+ ref: pullRequest.head.ref,
56+ sha: pullRequest.head.sha
57+ };
58+
2959 - name : Checkout repository
3060 uses : actions/checkout@v4
3161 with :
62+ ref : ${{ fromJSON(steps.pr.outputs.result).sha }}
3263 fetch-depth : 1
3364
3465 - name : Run Claude Code Review
@@ -38,19 +69,39 @@ jobs:
3869 anthropic_api_key : ${{ secrets.ANTHROPIC_API_KEY }}
3970 prompt : |
4071 REPO: ${{ github.repository }}
41- PR NUMBER: ${{ github.event.pull_request.number }}
42-
43- Please review this pull request and provide feedback on:
44- - Code quality and best practices
45- - Potential bugs or issues
46- - Performance considerations
47- - Security concerns
48- - Test coverage
49-
50- Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
51-
52- Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
53-
72+ PR NUMBER: ${{ github.event.issue.number }}
73+
74+ Review this Dory pull request. Use CLAUDE.md for detailed guidelines.
75+
76+ CRITICAL CHECKS:
77+ 1. TypeScript: Ensure strict mode compliance, proper typing, no 'any' without justification
78+ 2. MDX Components: Verify custom components follow existing patterns in src/mdx/
79+ 3. Vite Plugins: Any changes to build system must maintain LLM support functionality
80+ 4. Tailwind CSS: Use v4 utilities properly, ensure dark mode compatibility
81+
82+ REVIEW AREAS:
83+ - Code Quality: Clean, understandable code without overengineering
84+ - Component Patterns: Follow existing Preact functional component patterns
85+ - Build System: Vite config changes, custom plugin modifications
86+ - MDX Support: Proper sanitization with remarkSafeVars, custom component usage
87+ - Configuration: dory.json changes for navigation, branding
88+ - Performance: Bundle size impact, lazy loading where appropriate
89+ - Security: MDX sanitization, no XSS vulnerabilities, proper input validation
90+ - Dark Mode: All UI changes must work in both light and dark themes
91+ - Documentation: Ensure docs/ content is clear and accurate
92+ - Dependencies: pnpm usage (not npm/yarn), version compatibility
93+
94+ FOCUS ON:
95+ - Finding actual bugs and TypeScript issues
96+ - Ensuring existing functionality isn't broken
97+ - Maintaining clean code principles from CLAUDE.md
98+ - Verifying MDX content renders correctly
99+ - Checking API Playground, Mermaid diagrams, LaTeX math features still work
100+
101+ Be specific and actionable. Reference file:line_number when pointing out issues.
102+
103+ Use `gh pr comment` to post your review as a single, well-formatted comment.
104+
54105 # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55106 # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
56107 claude_args : ' --allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
0 commit comments