mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 22:32:27 +08:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
123 lines
5.4 KiB
YAML
123 lines
5.4 KiB
YAML
name: Claude Code
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
pull_request_review_comment:
|
|
types: [created]
|
|
issues:
|
|
types: [opened, assigned]
|
|
pull_request_review:
|
|
types: [submitted]
|
|
pull_request_target:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
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'))
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
id-token: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Configure AWS Credentials
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
with:
|
|
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
|
|
aws-region: us-east-1
|
|
|
|
- name: Run Claude Code
|
|
uses: anthropics/claude-code-action@v1
|
|
with:
|
|
use_bedrock: "true"
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
pr-review:
|
|
if: github.event_name == 'pull_request_target'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
id-token: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Configure AWS Credentials
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
with:
|
|
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
|
|
aws-region: us-east-1
|
|
|
|
- name: Run Claude Code PR Review
|
|
uses: anthropics/claude-code-action@v1
|
|
with:
|
|
use_bedrock: "true"
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
allowed_non_write_users: "*"
|
|
prompt: |
|
|
REPO: ${{ github.repository }}
|
|
PR NUMBER: ${{ github.event.pull_request.number }}
|
|
|
|
This is a personal project - an AI-powered draw.io diagram generator built with:
|
|
- Next.js 15 with React 19
|
|
- 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`.
|
|
For each previous comment:
|
|
- If the issue is fixed in the current code, resolve the comment thread using:
|
|
- Multiple AI providers: Bedrock, Anthropic, OpenAI, Google, Azure, OpenRouter, Ollama
|
|
|
|
STEP 1: Check existing comments to avoid duplicates.
|
|
Run: `gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/comments`
|
|
|
|
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 } } }'`
|
|
- If the issue still exists, remember this file:line - DO NOT create a new comment for it
|
|
|
|
STEP 2: Review the diff for issues, but SKIP any file:line that already has a comment.
|
|
|
|
Review this PR for these issues (report ALL that apply):
|
|
1. Bugs that would cause runtime errors or broken functionality
|
|
2. Security issues (exposed secrets, API key leaks)
|
|
3. AI SDK misuse - specifically check for:
|
|
- Client-side: Should use useChat/useCompletion/useObject hooks, NOT raw fetch()
|
|
- Server-side: Should use streamText/generateText/streamObject/generateObject
|
|
- Message handling: Access message.parts array, not legacy content property
|
|
- Tool definitions: Must use Zod schemas for inputSchema
|
|
- Status handling: Check status (submitted/streaming/ready/error) before actions
|
|
- 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.
|
|
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:
|
|
- Minor performance optimizations
|
|
- Code style preferences (unless clearly wrong)
|
|
- Type annotations that don't affect functionality
|
|
|
|
IMPORTANT:
|
|
- 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: |
|
|
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api:*),WebFetch(domain:ai-sdk.dev)"
|