mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 22:32:27 +08:00
fix: prevent duplicate PR review comments by tracking existing comments
This commit is contained in:
35
.github/workflows/claude-code.yml
vendored
35
.github/workflows/claude-code.yml
vendored
@@ -77,16 +77,17 @@ jobs:
|
|||||||
- Vercel AI SDK (streamText, useChat, tool calling)
|
- Vercel AI SDK (streamText, useChat, tool calling)
|
||||||
- Multiple AI providers: Bedrock, Anthropic, OpenAI, Google, Azure, OpenRouter, Ollama
|
- Multiple AI providers: Bedrock, Anthropic, OpenAI, Google, Azure, OpenRouter, Ollama
|
||||||
|
|
||||||
First, check previous review comments from github-actions bot using `gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/comments`.
|
STEP 1: Check existing comments to avoid duplicates.
|
||||||
For each previous comment:
|
Run: `gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/comments`
|
||||||
- If the issue is fixed in the current code, resolve the comment thread using:
|
|
||||||
|
Build a list of files and line numbers that already have comments. For each existing comment:
|
||||||
|
- If the issue is FIXED in current code, resolve the thread using:
|
||||||
`gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'`
|
`gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'`
|
||||||
Get the thread ID from the comment's node_id field.
|
- If the issue still exists, remember this file:line - DO NOT create a new comment for it
|
||||||
- If the issue still exists, leave it alone
|
|
||||||
|
|
||||||
Then review the current diff for NEW issues only:
|
STEP 2: Review the diff for issues, but SKIP any file:line that already has a comment.
|
||||||
|
|
||||||
Review this PR for ONLY these issues:
|
Review this PR for these issues (report ALL that apply):
|
||||||
1. Bugs that would cause runtime errors or broken functionality
|
1. Bugs that would cause runtime errors or broken functionality
|
||||||
2. Security issues (exposed secrets, API key leaks)
|
2. Security issues (exposed secrets, API key leaks)
|
||||||
3. AI SDK misuse - specifically check for:
|
3. AI SDK misuse - specifically check for:
|
||||||
@@ -96,18 +97,22 @@ jobs:
|
|||||||
- Tool definitions: Must use Zod schemas for inputSchema
|
- Tool definitions: Must use Zod schemas for inputSchema
|
||||||
- Status handling: Check status (submitted/streaming/ready/error) before actions
|
- Status handling: Check status (submitted/streaming/ready/error) before actions
|
||||||
- Stream cleanup: Call stop() when aborting streams
|
- Stream cleanup: Call stop() when aborting streams
|
||||||
|
4. Unrelated changes that should be in separate PRs (scope creep)
|
||||||
|
5. Suspicious .gitignore additions or accidentally committed files
|
||||||
|
6. UI/UX inconsistencies (e.g., alignment issues)
|
||||||
|
|
||||||
When reviewing AI SDK usage, fetch https://ai-sdk.dev/docs/ to verify correct patterns.
|
When reviewing AI SDK usage, fetch https://ai-sdk.dev/docs/ to verify correct patterns.
|
||||||
Key doc pages: /docs/ai-sdk-ui/chatbot, /docs/ai-sdk-core/generating-text, /docs/ai-sdk-core/tools-and-tool-calling
|
Key doc pages: /docs/ai-sdk-ui/chatbot, /docs/ai-sdk-core/generating-text, /docs/ai-sdk-core/tools-and-tool-calling
|
||||||
|
|
||||||
DO NOT comment on:
|
DO NOT comment on:
|
||||||
- Performance optimizations
|
- Minor performance optimizations
|
||||||
- Code style or formatting
|
- Code style preferences (unless clearly wrong)
|
||||||
- "Best practices" that don't affect functionality
|
- Type annotations that don't affect functionality
|
||||||
- Type safety improvements
|
|
||||||
- Error handling additions
|
|
||||||
|
|
||||||
Use `mcp__github_inline_comment__create_inline_comment` for inline comments.
|
IMPORTANT:
|
||||||
Be very selective - if there are no real bugs, just say "LGTM" in a PR comment.
|
- NEVER create a comment on a file:line that already has a comment - this causes duplicates
|
||||||
|
- For each NEW issue, use `mcp__github_inline_comment__create_inline_comment` to comment on the specific line
|
||||||
|
- ALWAYS include a suggested fix using GitHub's suggestion syntax: ```suggestion\n<fixed code>\n```
|
||||||
|
- Only say "LGTM" if there are truly ZERO new issues to report
|
||||||
claude_args: |
|
claude_args: |
|
||||||
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api:*),WebFetch(domain:ai-sdk.dev)"
|
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api:*),WebFetch(domain:ai-sdk.dev)"
|
||||||
|
|||||||
Reference in New Issue
Block a user