From 846d1bebac1d11d87d2df78ed4e1d7a72274fe4d Mon Sep 17 00:00:00 2001 From: Ankur Gohain <68453512+ankurgohain@users.noreply.github.com> Date: Wed, 13 Aug 2025 23:43:01 +0530 Subject: [PATCH] commit changes --- .github/workflows/code-review.yml | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/code-review.yml diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml new file mode 100644 index 0000000..5e13ffb --- /dev/null +++ b/.github/workflows/code-review.yml @@ -0,0 +1,41 @@ +name: Gemini AI Code Reviewer + +on: + issue_comment: + types: [created] + +permissions: write-all + +jobs: + gemini-code-review: + runs-on: ubuntu-latest + if: | + github.event.issue.pull_request && + contains(github.event.comment.body, '/gemini-review') + steps: + - name: PR Info + run: | + echo "Comment: ${{ github.event.comment.body }}" + echo "Issue Number: ${{ github.event.issue.number }}" + echo "Repository: ${{ github.repository }}" + + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get PR Details + id: pr + run: | + PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}) + echo "head_sha=$(echo $PR_JSON | jq -r .head.sha)" >> $GITHUB_OUTPUT + echo "base_sha=$(echo $PR_JSON | jq -r .base.sha)" >> $GITHUB_OUTPUT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: truongnh1992/gemini-ai-code-reviewer@main + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} + GEMINI_MODEL: gemini-2.5-pro-preview-05-06 # Optional, default is `gemini-2.0-flash-001` + EXCLUDE: "*.md,*.txt,package-lock.json,*.yml,*.yaml" \ No newline at end of file