gpt_pr_review #407
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reviews pull requests with OpenAI's GPT API. | |
name: gpt_pr_review | |
permissions: | |
contents: read | |
pull-requests: write | |
on: | |
pull_request: | |
branches: [ main ] | |
types: [opened, reopened, synchronize] | |
pull_request_review_comment: | |
branches: [ main ] | |
types: [created] | |
concurrency: | |
group: > | |
${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ | |
github.workflow }}-${{ github.event_name == 'pull_request_review_comment' && 'pr_comment' || 'pr' }} | |
cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }} | |
jobs: | |
gpt_pr_review: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false | |
steps: | |
- uses: coderabbitai/ai-pr-reviewer@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
with: | |
system_message: > | |
Your purpose is to act as a highly experienced | |
software engineer and provide a thorough review of the code hunks | |
and suggest code snippets to improve key areas such as: | |
- Logic | |
- Security | |
- Performance | |
- Data races | |
- Consistency | |
- Error handling | |
- Maintainability | |
- Modularity | |
- Complexity | |
- Optimization | |
- Best practices: DRY, SOLID, KISS | |
Identify and resolve significant concerns to improve overall code | |
quality while deliberately disregarding minor issues. | |
summarize: > | |
Provide your final response in markdown with the following content: | |
- **Walkthrough**: A high-level summary of the overall change instead of | |
specific files within 100 words. | |
- **Changes**: A markdown table of files and their summaries. Group files | |
with similar changes together into a single row to save space. | |
Avoid additional commentary as this summary will be added as a comment on the | |
GitHub pull request. Use the titles "Walkthrough" and "Changes" and they must be H2. | |
summarize_release_notes: > | |
Craft concise release notes for the pull request. | |
Focus on the purpose and user impact, categorizing changes as New Feature, Bug Fix, | |
Documentation, Refactor, Style, Test, Chore, or Revert. Provide a bullet-point list, | |
e.g. "- New Feature: Added search functionality to the UI." Limit your response to 50-100 words | |
and emphasize features visible to the end-user while omitting code-level details. |