From 0d60fba08fa34a94e220f6fb664f6df981a7235f Mon Sep 17 00:00:00 2001 From: Cynthia Long Date: Mon, 2 Mar 2026 14:36:08 +0000 Subject: [PATCH 1/7] feat: integrate code review extension in pr review flow --- .github/workflows/gemini-review.yml | 7 ++++++- examples/workflows/pr-review/gemini-review.yml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gemini-review.yml b/.github/workflows/gemini-review.yml index dc525cd74..4e580fd1d 100644 --- a/.github/workflows/gemini-review.yml +++ b/.github/workflows/gemini-review.yml @@ -51,6 +51,7 @@ jobs: PULL_REQUEST_NUMBER: '${{ github.event.pull_request.number || github.event.issue.number }}' REPOSITORY: '${{ github.repository }}' ADDITIONAL_CONTEXT: '${{ inputs.additional_context }}' + GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}' with: gcp_location: '${{ vars.GOOGLE_CLOUD_LOCATION }}' gcp_project_id: '${{ vars.GOOGLE_CLOUD_PROJECT }}' @@ -106,4 +107,8 @@ jobs: ] } } - prompt: '/gemini-review' + extensions: | + [ + "https://github.com/gemini-cli-extensions/code-review" + ] + prompt: '/code-review pr-review' diff --git a/examples/workflows/pr-review/gemini-review.yml b/examples/workflows/pr-review/gemini-review.yml index 28313594f..b400b28e4 100644 --- a/examples/workflows/pr-review/gemini-review.yml +++ b/examples/workflows/pr-review/gemini-review.yml @@ -51,6 +51,7 @@ jobs: PULL_REQUEST_NUMBER: '${{ github.event.pull_request.number || github.event.issue.number }}' REPOSITORY: '${{ github.repository }}' ADDITIONAL_CONTEXT: '${{ inputs.additional_context }}' + GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}' with: gcp_location: '${{ vars.GOOGLE_CLOUD_LOCATION }}' gcp_project_id: '${{ vars.GOOGLE_CLOUD_PROJECT }}' @@ -106,4 +107,8 @@ jobs: ] } } - prompt: '/gemini-review' + extensions: | + [ + "https://github.com/gemini-cli-extensions/code-review" + ] + prompt: '/code-review pr-review' From 404a69052661a01d86938b180d8136b1d200bf0a Mon Sep 17 00:00:00 2001 From: Cynthia Long Date: Mon, 2 Mar 2026 14:54:31 +0000 Subject: [PATCH 2/7] feat: update readme --- examples/workflows/pr-review/README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/workflows/pr-review/README.md b/examples/workflows/pr-review/README.md index 2b91c5564..d4975e73f 100644 --- a/examples/workflows/pr-review/README.md +++ b/examples/workflows/pr-review/README.md @@ -34,7 +34,7 @@ This document explains how to use the Gemini CLI on GitHub to automatically revi ## Overview -The PR Review workflow uses Google's Gemini AI to provide comprehensive code reviews for pull requests. It analyzes code quality, security, performance, and maintainability while providing constructive feedback in a structured format. +The PR Review workflow uses Google's Gemini AI and [code review extension](https://github.com/gemini-cli-extensions/code-review) to provide comprehensive code reviews for pull requests. It analyzes code quality, security, performance, and maintainability while providing constructive feedback in a structured format. ## Features @@ -178,16 +178,15 @@ After posting all inline comments, the action submits the review with a final su The action provides specific, actionable feedback directly on the relevant lines of code in the pull request. Each comment includes: - **Priority**: An emoji indicating the severity of the feedback. - - 🔴 **Critical**: Must be fixed before merging (e.g., security vulnerabilities, breaking changes). - - 🟠 **High**: Should be addressed (e.g., performance issues, design flaws). - - 🟡 **Medium**: Recommended improvements (e.g., code quality, style). - - 🟢 **Low**: Nice-to-have suggestions (e.g., documentation, minor refactoring). - - 🔵 **Unclear**: Priority is not determined. + - **Critical**: Must be fixed before merging (e.g., security vulnerabilities, breaking changes). + - **High**: Should be addressed (e.g., performance issues, design flaws). + - **Medium**: Recommended improvements (e.g., code quality, style). + - **Low**: Nice-to-have suggestions (e.g., documentation, minor refactoring). - **Suggestion**: A code block with a suggested change, where applicable. **Example Inline Comment:** -> 🟢 Use camelCase for function names +> Use camelCase for function names > > ```suggestion > myFunction @@ -216,7 +215,7 @@ You can customize the workflow by modifying: ### Review Prompt Customization -The review prompt is defined in the `gemini-review.toml` file. The action automatically copies this file from `.github/commands/` to `.gemini/commands/` during execution. +The review prompt utilize [code review extension](https://github.com/gemini-cli-extensions/code-review) and its defined prompt. **To customize the review prompt:** @@ -224,7 +223,7 @@ The review prompt is defined in the `gemini-review.toml` file. The action automa ```bash mkdir -p .gemini/commands - curl -o .gemini/commands/gemini-review.toml https://raw.githubusercontent.com/google-github-actions/run-gemini-cli/main/examples/workflows/pr-review/gemini-review.toml + curl -o .gemini/commands/gemini-review.toml https://raw.githubusercontent.com/gemini-cli-extensions/code-review/main/commands/code-review.toml ``` 2. Edit `.gemini/commands/gemini-review.toml` to customize: From 94f0b77e69e3d6a96baae5bb574161b59c74eaae Mon Sep 17 00:00:00 2001 From: Cynthia Long Date: Mon, 2 Mar 2026 14:55:05 +0000 Subject: [PATCH 3/7] update readme --- examples/workflows/pr-review/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/workflows/pr-review/README.md b/examples/workflows/pr-review/README.md index d4975e73f..b519379f5 100644 --- a/examples/workflows/pr-review/README.md +++ b/examples/workflows/pr-review/README.md @@ -232,6 +232,12 @@ The review prompt utilize [code review extension](https://github.com/gemini-cli- - Include project-specific guidelines - Adjust review depth and focus areas +3. Edit `.github/workflows/gemini-review.yml` to use the customized prompt: + ```yml + - prompt: '/code-review pr-review' + + prompt: '/gemini-review' + ``` + 3. Commit the file to your repository: ```bash git add .gemini/commands/gemini-review.toml From 05aabc51d3f5888e9ba89215775d38e1a3f9b96c Mon Sep 17 00:00:00 2001 From: Cynthia Long Date: Mon, 2 Mar 2026 17:30:12 +0000 Subject: [PATCH 4/7] update pr review test --- evals/pr-review.eval.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/evals/pr-review.eval.ts b/evals/pr-review.eval.ts index 648954bb7..2c0eadbd7 100644 --- a/evals/pr-review.eval.ts +++ b/evals/pr-review.eval.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; import { TestRig } from './test-rig'; -import { mkdirSync, copyFileSync, readFileSync } from 'node:fs'; +import { mkdirSync, copyFileSync, readFileSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; import { execSync } from 'node:child_process'; @@ -13,6 +13,8 @@ interface ReviewCase { const datasetPath = join(__dirname, 'data/pr-review.json'); const dataset: ReviewCase[] = JSON.parse(readFileSync(datasetPath, 'utf-8')); +const REVIEW_TOML_URL = + 'https://raw.githubusercontent.com/gemini-cli-extensions/code-review/main/commands/code-review.toml'; describe('PR Review Workflow', () => { for (const item of dataset) { @@ -22,14 +24,17 @@ describe('PR Review Workflow', () => { const rig = new TestRig(`review-${item.id}`); try { rig.setupMockMcp(); - mkdirSync(join(rig.testDir, '.gemini/commands'), { recursive: true }); - copyFileSync( - '.github/commands/gemini-review.toml', - join(rig.testDir, '.gemini/commands/gemini-review.toml'), - ); + const commandDir = join(rig.testDir, '.gemini/commands'); + mkdirSync(commandDir, { recursive: true }); + + const response = await fetch(REVIEW_TOML_URL); + if (!response.ok) + throw new Error(`Failed to fetch TOML: ${response.statusText}`); + const tomlContent = await response.text(); + writeFileSync(join(commandDir, 'code-review.toml'), tomlContent); const stdout = await rig.run( - ['--prompt', '/gemini-review', '--yolo'], + ['--prompt', '/code-review', 'pr-review', '--yolo'], item.inputs, ); From 7a5f6fc0358b6e0bf1e22090578cc8611e8f1696 Mon Sep 17 00:00:00 2001 From: Cynthia Long Date: Mon, 2 Mar 2026 17:33:40 +0000 Subject: [PATCH 5/7] update readme --- examples/workflows/pr-review/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/workflows/pr-review/README.md b/examples/workflows/pr-review/README.md index b519379f5..38644e15a 100644 --- a/examples/workflows/pr-review/README.md +++ b/examples/workflows/pr-review/README.md @@ -233,12 +233,13 @@ The review prompt utilize [code review extension](https://github.com/gemini-cli- - Adjust review depth and focus areas 3. Edit `.github/workflows/gemini-review.yml` to use the customized prompt: + ```yml - prompt: '/code-review pr-review' - + prompt: '/gemini-review' + + prompt: '/gemini-review pr-review' ``` -3. Commit the file to your repository: +4. Commit the file to your repository: ```bash git add .gemini/commands/gemini-review.toml git commit -m "feat: customize PR review prompt" From 4f29e6c6f513d0cf77859c69bfef2f2398c24241 Mon Sep 17 00:00:00 2001 From: Cynthia Long Date: Mon, 2 Mar 2026 17:43:42 +0000 Subject: [PATCH 6/7] cleanup --- evals/pr-review.eval.ts | 2 +- examples/workflows/pr-review/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/evals/pr-review.eval.ts b/evals/pr-review.eval.ts index 2c0eadbd7..a433bd253 100644 --- a/evals/pr-review.eval.ts +++ b/evals/pr-review.eval.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; import { TestRig } from './test-rig'; -import { mkdirSync, copyFileSync, readFileSync, writeFileSync } from 'node:fs'; +import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; import { execSync } from 'node:child_process'; diff --git a/examples/workflows/pr-review/README.md b/examples/workflows/pr-review/README.md index 38644e15a..603ac7f1f 100644 --- a/examples/workflows/pr-review/README.md +++ b/examples/workflows/pr-review/README.md @@ -215,7 +215,7 @@ You can customize the workflow by modifying: ### Review Prompt Customization -The review prompt utilize [code review extension](https://github.com/gemini-cli-extensions/code-review) and its defined prompt. +The review prompt utilizes [code review extension](https://github.com/gemini-cli-extensions/code-review) and its defined prompt. **To customize the review prompt:** From 83e9c55a23e84aceb410fe7283aa176548b2fbd0 Mon Sep 17 00:00:00 2001 From: Cynthia Long Date: Mon, 2 Mar 2026 18:57:51 +0000 Subject: [PATCH 7/7] Update test prompt --- evals/pr-review.eval.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evals/pr-review.eval.ts b/evals/pr-review.eval.ts index a433bd253..325eebc16 100644 --- a/evals/pr-review.eval.ts +++ b/evals/pr-review.eval.ts @@ -34,7 +34,7 @@ describe('PR Review Workflow', () => { writeFileSync(join(commandDir, 'code-review.toml'), tomlContent); const stdout = await rig.run( - ['--prompt', '/code-review', 'pr-review', '--yolo'], + ['--prompt', '"/code-review pr-review"', '--yolo'], item.inputs, );