diff --git a/.github/prompts/ai-review.md b/.github/prompts/ai-review.md new file mode 100644 index 000000000..1feb615c2 --- /dev/null +++ b/.github/prompts/ai-review.md @@ -0,0 +1,16 @@ +1. **Security vulnerabilities** - Label by criticality (Critical/High/Medium/Low) + - Solidity: e.g. reentrancy, access control, integer issues, etc. + - Rust: e.g. unsafe blocks, error handling, panics, etc. + - Web/API: e.g. SQL injection, auth bypass, input validation, sensitive data exposure, CORS/CSRF, etc. + +2. **Potential bugs** - Logic errors, edge cases, incorrect behavior, race conditions + +3. **Performance issues** - Only significant: e.g. O(n²) on unbounded input, N+1 queries, unbounded memory growth + +4. **Simplicity** - Prefer simple, readable code over clever abstractions + +Guidelines: +- Do NOT suggest micro-optimizations or premature abstractions +- Always prefer simplicity over complexity when performance gains are marginal +- Focus on real issues, not hypothetical improvements +- Be concise and actionable diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml new file mode 100644 index 000000000..e9eaabd00 --- /dev/null +++ b/.github/workflows/ai-review.yml @@ -0,0 +1,105 @@ +name: AI Code Review + +on: + pull_request: + types: [opened, reopened, ready_for_review] + issue_comment: + types: [created] + +permissions: {} + +jobs: + claude-review: + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false && + github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && + contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) && + (startsWith(github.event.comment.body, '/claude') || github.event.comment.body == '/review' || startsWith(github.event.comment.body, '/review ') || startsWith(github.event.comment.body, fromJSON('"/review\n"')) || startsWith(github.event.comment.body, fromJSON('"/review\r"')))) + uses: yetanotherco/actions/.github/workflows/pr_review_claude.yml@4a4279fdc553ad030894c98698582baaeb40327a # v2.0.0 + permissions: + contents: read + pull-requests: write + issues: read + secrets: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + + codex-review: + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false && + github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && + contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) && + (startsWith(github.event.comment.body, '/codex') || github.event.comment.body == '/review' || startsWith(github.event.comment.body, '/review ') || startsWith(github.event.comment.body, fromJSON('"/review\n"')) || startsWith(github.event.comment.body, fromJSON('"/review\r"')))) + uses: yetanotherco/actions/.github/workflows/pr_review_codex.yml@4a4279fdc553ad030894c98698582baaeb40327a # v2.0.0 + permissions: + contents: read + issues: write + pull-requests: write + secrets: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + + kimi-review: + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false && + github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && + contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) && + (startsWith(github.event.comment.body, '/kimi') || github.event.comment.body == '/review' || startsWith(github.event.comment.body, '/review ') || startsWith(github.event.comment.body, fromJSON('"/review\n"')) || startsWith(github.event.comment.body, fromJSON('"/review\r"')))) + uses: yetanotherco/actions/.github/workflows/pr_review_kimi.yml@4a4279fdc553ad030894c98698582baaeb40327a # v2.0.0 + permissions: + contents: read + pull-requests: write + secrets: + KIMI_API_KEY: ${{ secrets.KIMI_API_KEY }} + + deepseek-review: + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false && + github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && + contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) && + (startsWith(github.event.comment.body, '/deepseek') || github.event.comment.body == '/review' || startsWith(github.event.comment.body, '/review ') || startsWith(github.event.comment.body, fromJSON('"/review\n"')) || startsWith(github.event.comment.body, fromJSON('"/review\r"')))) + uses: yetanotherco/actions/.github/workflows/pr_review_openrouter.yml@4a4279fdc553ad030894c98698582baaeb40327a # v2.0.0 + permissions: + contents: read + pull-requests: write + with: + model: deepseek/deepseek-v4-pro-0813 + reasoning_effort: high + max_bytes: 2400000 + secrets: + OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} + + grok-review: + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false && + github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && + contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) && + (startsWith(github.event.comment.body, '/grok') || github.event.comment.body == '/review' || startsWith(github.event.comment.body, '/review ') || startsWith(github.event.comment.body, fromJSON('"/review\n"')) || startsWith(github.event.comment.body, fromJSON('"/review\r"')))) + uses: yetanotherco/actions/.github/workflows/pr_review_openrouter.yml@4a4279fdc553ad030894c98698582baaeb40327a # v2.0.0 + permissions: + contents: read + pull-requests: write + with: + model: x-ai/grok-4.7 + secrets: + OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} + + gemini-review: + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false && + github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && + contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) && + (startsWith(github.event.comment.body, '/gemini') || github.event.comment.body == '/review' || startsWith(github.event.comment.body, '/review ') || startsWith(github.event.comment.body, fromJSON('"/review\n"')) || startsWith(github.event.comment.body, fromJSON('"/review\r"')))) + uses: yetanotherco/actions/.github/workflows/pr_review_openrouter.yml@4a4279fdc553ad030894c98698582baaeb40327a # v2.0.0 + permissions: + contents: read + pull-requests: write + with: + model: google/gemini-4-argon + max_bytes: 2400000 + secrets: + OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} diff --git a/.github/workflows/pr_review_claude.yml b/.github/workflows/pr_review_claude.yml deleted file mode 100644 index 7649bd6b9..000000000 --- a/.github/workflows/pr_review_claude.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Claude Code Review - -on: - pull_request: - types: [opened, ready_for_review] - issue_comment: - types: [created] - -jobs: - claude-review: - if: | - (github.event_name == 'pull_request' && - github.event.pull_request.head.repo.full_name == github.repository) || - (github.event_name == 'issue_comment' && - github.event.issue.pull_request && - contains(github.event.comment.body, '/claude') && - contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) - uses: yetanotherco/actions/.github/workflows/pr_review_claude.yml@v1.0.1 - with: - custom_prompt: | - 1. **Security vulnerabilities** - Label by criticality (Critical/High/Medium/Low) - - Solidity: e.g. reentrancy, access control, integer issues, etc. - - Rust: e.g. unsafe blocks, error handling, panics, etc. - - Web/API: e.g. SQL injection, auth bypass, input validation, sensitive data exposure, CORS/CSRF, etc. - - 2. **Potential bugs** - Logic errors, edge cases, incorrect behavior, race conditions - - 3. **Performance issues** - Only significant: e.g. O(n²) on unbounded input, N+1 queries, unbounded memory growth - - 4. **Simplicity** - Prefer simple, readable code over clever abstractions - - Guidelines: - - Be concise and to the point - - Do NOT suggest micro-optimizations or premature abstractions - - Always prefer simplicity over complexity when performance gains are marginal - - Focus on real issues, not hypothetical improvements - - Be concise and actionable - secrets: - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} diff --git a/.github/workflows/pr_review_codex.yml b/.github/workflows/pr_review_codex.yml deleted file mode 100644 index 350c945b1..000000000 --- a/.github/workflows/pr_review_codex.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Codex Code Review - -on: - pull_request: - types: [opened, ready_for_review] - issue_comment: - types: [created] - -jobs: - codex-review: - if: | - (github.event_name == 'pull_request' && - github.event.pull_request.head.repo.full_name == github.repository) || - (github.event_name == 'issue_comment' && - github.event.issue.pull_request && - contains(github.event.comment.body, '/codex') && - contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) - uses: yetanotherco/actions/.github/workflows/pr_review_codex.yml@v1.0.1 - with: - custom_prompt: | - 1. **Security vulnerabilities** - Label by criticality (Critical/High/Medium/Low) - - Solidity: e.g. reentrancy, access control, integer issues, etc. - - Rust: e.g. unsafe blocks, error handling, panics, etc. - - Web/API: e.g. SQL injection, auth bypass, input validation, sensitive data exposure, CORS/CSRF, etc. - - 2. **Potential bugs** - Logic errors, edge cases, incorrect behavior, race conditions - - 3. **Performance issues** - Only significant: e.g. O(n²) on unbounded input, N+1 queries, unbounded memory growth - - 4. **Simplicity** - Prefer simple, readable code over clever abstractions - - Guidelines: - - Be concise and to the point - - Do NOT suggest micro-optimizations or premature abstractions - - Always prefer simplicity over complexity when performance gains are marginal - - Focus on real issues, not hypothetical improvements - - Be concise and actionable - secrets: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}