Skip to content
Latchkey

Gemini AI Code Reviewer workflow (truongnh1992/gemini-ai-code-reviewer)

The Gemini AI Code Reviewer workflow from truongnh1992/gemini-ai-code-reviewer, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: truongnh1992/gemini-ai-code-reviewer.github/workflows/code-reviewer-action.ymlLicense MITView source

What it does

This is the Gemini AI Code Reviewer workflow from the truongnh1992/gemini-ai-code-reviewer repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
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: Checkout Repo
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: Install dependencies
        run: |
          pip install -r requirements.txt

      - name: Run Gemini AI Code Reviewer
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
        run: |
          python3.10 review_code_gemini.py

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Gemini AI Code Reviewer
 
on:
  issue_comment:
    types: [created]
permissions: write-all
jobs:
  gemini-code-review:
    timeout-minutes: 30
    runs-on: latchkey-small
    if: |
      github.event.issue.pull_request &&
      contains(github.event.comment.body, '/gemini-review')
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
 
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          cache: 'pip'
          python-version: '3.10'
 
      - name: Install dependencies
        run: |
          pip install -r requirements.txt
 
      - name: Run Gemini AI Code Reviewer
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
        run: |
          python3.10 review_code_gemini.py

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow