|
| 1 | +name: PR Review |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + types: [opened, synchronize, labeled, unlabeled] |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + pull-requests: write |
| 9 | + |
| 10 | +jobs: |
| 11 | + review: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v3 |
| 15 | + |
| 16 | + - name: AI PR Review |
| 17 | + uses: jonit-dev/openrouter-github-action@main |
| 18 | + with: |
| 19 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + open_router_key: ${{ secrets.OPEN_ROUTER_KEY }} |
| 21 | + model_id: 'z-ai/glm-5' |
| 22 | + # model_id: 'openai/gpt-5.2-codex' |
| 23 | + # reasoning_effort: 'xhigh' |
| 24 | + max_tokens: '4096' |
| 25 | + max_pr_reviews: '2' |
| 26 | + cooldown_period: '5' |
| 27 | + custom_prompt: | |
| 28 | + ### **AI PR Review Instructions** |
| 29 | +
|
| 30 | + **Objective:** |
| 31 | + Provide a clear, concise, and actionable review of the Pull Request (PR). Focus on overall codebase quality, including readability, maintainability, functionality, adherence to best practices, performance optimizations, and testing coverage. Avoid minor nitty-picky comments and repetitive feedback. |
| 32 | +
|
| 33 | + **Focus Areas:** |
| 34 | + 1. **Code Quality:** Assess the readability, organization, and maintainability of the code. |
| 35 | + 2. **Functionality:** Ensure the PR meets its intended purpose and functions as expected. |
| 36 | + 3. **Best Practices:** Evaluate adherence to coding standards, design patterns, and project guidelines. |
| 37 | + 4. **Performance:** Identify any potential performance improvements or optimizations. |
| 38 | + 5. **Testing:** Review the comprehensiveness and effectiveness of the test coverage. |
| 39 | + 6. **Security:** Identify any potential security vulnerabilities or concerns. |
| 40 | + 7. **Bugs Found:** List any bugs identified in the PR. |
| 41 | + 8. **Issues Found:** Consolidate performance and testing issues into a unified section. |
| 42 | +
|
| 43 | + **Critical Instructions:** |
| 44 | + - If you have nothing to say about a particular section, you can omit it from the review. |
| 45 | + - If you think there are no issues and the PR is good to go, mention it in the conclusion. No need to add unnecessary feedback. Don't be redundant. |
| 46 | +
|
| 47 | + **Scoring Criteria:** |
| 48 | + - 90-100: Exceptional quality |
| 49 | + • Clean, efficient, and well-documented code |
| 50 | + • Comprehensive test coverage (>90%) |
| 51 | + • Follows all best practices and design patterns |
| 52 | + • No security vulnerabilities |
| 53 | + • Optimal performance considerations |
| 54 | + • Clear documentation and comments |
| 55 | +
|
| 56 | + - 75-89: High quality |
| 57 | + • Well-structured and maintainable code |
| 58 | + • Good test coverage (70-90%) |
| 59 | + • Minor optimization opportunities |
| 60 | + • No critical security issues |
| 61 | + • Few non-critical issues |
| 62 | + • Adequate documentation |
| 63 | +
|
| 64 | + - 60-74: Average quality |
| 65 | + • Functional but needs improvement |
| 66 | + • Basic test coverage (40-70%) |
| 67 | + • Some code duplication |
| 68 | + • Multiple minor issues |
| 69 | + • Basic security considerations |
| 70 | + • Limited documentation |
| 71 | +
|
| 72 | + - 40-59: Below average |
| 73 | + • Significant structural issues |
| 74 | + • Poor test coverage (<40%) |
| 75 | + • Multiple security concerns |
| 76 | + • Performance bottlenecks |
| 77 | + • Inadequate error handling |
| 78 | + • Missing or unclear documentation |
| 79 | +
|
| 80 | + - 0-39: Poor quality |
| 81 | + • Major architectural problems |
| 82 | + • Missing or broken tests |
| 83 | + • Critical security vulnerabilities |
| 84 | + • Severe performance issues |
| 85 | + • No error handling |
| 86 | + • No documentation |
| 87 | + • Breaking changes without justification |
| 88 | +
|
| 89 | + **Review Structure:** |
| 90 | +
|
| 91 | + 1. **Overall Summary** |
| 92 | + - **Score:** Provide a score from 0-100. |
| 93 | + - **Summary:** Brief overview of the PR, highlighting its purpose and main changes. |
| 94 | +
|
| 95 | + 2. **Key Strengths** |
| 96 | + - Highlight 2-3 major strengths related to code quality and overall implementation. |
| 97 | +
|
| 98 | + 3. **Areas for Improvement** |
| 99 | + - Identify 2-3 significant areas that need enhancement, if any. |
| 100 | + - Provide actionable suggestions for each identified issue. |
| 101 | +
|
| 102 | + 4. **Bugs Found** (if any) |
| 103 | + - Present any bugs identified in the PR in a table format. |
| 104 | + - **Table Columns:** Bug Name, Affected Files, Description, Confidence (High 🟢, Medium 🟡, Low 🔴) |
| 105 | +
|
| 106 | + 5. **Issues Found** (if any) |
| 107 | + - Consolidate performance and testing issues into a single table. |
| 108 | + - **Table Columns:** Issue Type, Issue Name, Affected Components, Description, Impact/Severity |
| 109 | +
|
| 110 | + 6. **Conclusion** |
| 111 | + - A short closing statement summarizing the overall quality of the PR and its readiness for merging. |
| 112 | +
|
| 113 | + **Example Output:** |
| 114 | +
|
| 115 | + ### **AI Review Summary** |
| 116 | +
|
| 117 | + **🏆 Overall Score:** 85/100 |
| 118 | +
|
| 119 | + *The PR successfully implements XYZ with clean and well-structured code.* |
| 120 | +
|
| 121 | + **✅ Key Strengths** |
| 122 | + - **Feature Implementation:** Effectively adds the new feature |
| 123 | + - **Code Structure:** Well-organized with logical separation of concerns |
| 124 | +
|
| 125 | + **⚠️ Areas for Improvement** |
| 126 | + - **Error Handling:** Implement more robust error handling |
| 127 | +
|
| 128 | + **🔚 Conclusion** |
| 129 | + *The PR is well-executed. Addressing the highlighted issues will further strengthen the codebase.* |
0 commit comments