From 2a4ff557ed6ef90f337e783fb6bd1a06420ebceb Mon Sep 17 00:00:00 2001 From: harderthan Date: Sat, 2 Aug 2025 17:11:12 +0900 Subject: [PATCH] Add AI Code Reviews workflow Introduced a GitHub Actions workflow for AI Code Reviews. This feature will automatically trigger an AI-powered code review on every pull request and pull request review comment, enhancing the quality of our codebase by identifying potential issues related to logic, security, performance, and more.# Please enter the commit message for your changes. Lines starting --- .github/workflows/ai-codereviewer.yml | 26 ------------------------- .github/workflows/ai-review.yml | 28 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/ai-codereviewer.yml create mode 100644 .github/workflows/ai-review.yml diff --git a/.github/workflows/ai-codereviewer.yml b/.github/workflows/ai-codereviewer.yml deleted file mode 100644 index 731e729c..00000000 --- a/.github/workflows/ai-codereviewer.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: AI Code Reviewer - -on: - pull_request: - types: - - opened - - synchronize - -permissions: - pull-requests: write - contents: read - -jobs: - review: - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - - name: AI Code Reviewer - uses: harderthan/ai-codereviewer@main - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # The GITHUB_TOKEN is there by default so you just need to keep it like it is and not necessarily need to add it as secret as it will throw an error. [More Details](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret) - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - OPENAI_API_MODEL: "gpt-4" # Optional: defaults to "gpt-4" - exclude: "third_party/*, **/*.json, **/*.md, **/*.txt" diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml new file mode 100644 index 00000000..4c2c86ef --- /dev/null +++ b/.github/workflows/ai-review.yml @@ -0,0 +1,28 @@ +name: AI Code Reviewer + +permissions: + contents: read + pull-requests: write + +on: + pull_request: + pull_request_review_comment: + 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: + review: + runs-on: ubuntu-latest + steps: + - uses: coderabbitai/ai-pr-reviewer@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + with: + debug: false + review_simple_changes: false + review_comment_lgtm: true