Skip to content

Gemini CLI setup for PR 5557 - 58c5c5174569f66dd1dacc87169fcfda4d05aaa5 #2

Gemini CLI setup for PR 5557 - 58c5c5174569f66dd1dacc87169fcfda4d05aaa5

Gemini CLI setup for PR 5557 - 58c5c5174569f66dd1dacc87169fcfda4d05aaa5 #2

name: Gemini CLI PR Setup
on:
pull_request:
types: [opened, synchronize, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
run-name: Gemini CLI setup for PR ${{ github.event.pull_request.number }} - ${{ github.event.pull_request.head.sha }}
jobs:
gemini-hello:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Gemini CLI
uses: ./.github/actions/setup-gemini
with:
node-version: '20'
- name: Run Gemini hello prompt
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
echo "=== GEMINI START ==="
gemini "hello" | tee /dev/stderr
echo "=== GEMINI END ==="
gemini-pr-review:
# Skip if PR is in draft
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install/Upgrade Google Python Client
shell: bash
run: |
python -m pip install --upgrade pip
pip install --upgrade google-generativeai
# If you have a requirements.txt file, you might use this instead:
# pip install -r requirements.txt --upgrade
- name: Setup Gemini CLI
uses: ./.github/actions/setup-gemini
with:
node-version: '20'
- name: Setup Gemini CLI
uses: ./.github/actions/setup-gemini
with:
node-version: '20'
# --- ADD THIS NEW DEBUG STEP ---
- name: Debug Gemini Path (Before Python)
shell: bash
run: |
echo "--- Verifying gemini-cli before Python script ---"
echo "Full PATH: $PATH"
echo "Location of gemini:"
which gemini
echo "Version of gemini:"
gemini --version
echo "------------------------------------------------"
- name: Run Gemini PR review
env:
#GEMINI_MODEL: gemini-1.5-flash-latest
GEMINI_OUTPUT_DIR: artifacts/gemini_review/${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
python -m tools.pr_preflight_launcher_gemini
- name: Print Gemini error (if any)
if: always()
run: |
if [ -f "${{ env.GEMINI_OUTPUT_DIR }}/error.txt" ]; then
echo "===== Gemini error.txt ====="
sed -n '1,200p' "${{ env.GEMINI_OUTPUT_DIR }}/error.txt"
else
echo "No error.txt found in ${{ env.GEMINI_OUTPUT_DIR }}"
fi
- name: Upload Gemini review artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: gemini-review-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
path: ${{ env.GEMINI_OUTPUT_DIR }}/**