From 5d498e25a42bef7d3469daa01c26e86d35edce49 Mon Sep 17 00:00:00 2001 From: GREENRAT-K405 Date: Wed, 11 Feb 2026 00:49:14 +0530 Subject: [PATCH] add automatic pull request gemini review --- .github/workflows/PR-review.yaml | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/PR-review.yaml diff --git a/.github/workflows/PR-review.yaml b/.github/workflows/PR-review.yaml new file mode 100644 index 0000000..83d480d --- /dev/null +++ b/.github/workflows/PR-review.yaml @@ -0,0 +1,46 @@ +name: AI Code Reviewer + +on: + issue_comment: + types: [created] + +permissions: + contents: read + pull-requests: write + issues: write + +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 + ref: refs/pull/${{ github.event.issue.number }}/head + + - 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-flash + EXCLUDE: "*.md,*.txt,package-lock.json" + \ No newline at end of file