Skip to content

chore: automated code review using antigravity #2

chore: automated code review using antigravity

chore: automated code review using antigravity #2

name: Automated Code Review
# TODO: Eventually, use pull_request_target instead of pull_request.
# pull_request_target runs in the base branch context and has access
# to secrets (like GEMINI_API_KEY) even for fork PRs.
# Using pull_request for now during setup/testing.
on:
pull_request:
types: [opened]
pull_request_review_comment:
types: [created]
permissions:
contents: read
pull-requests: read
jobs:
review:
runs-on: ubuntu-latest
# Trigger only if:
# 1. It is a pull_request event, it is NOT a draft, and the author is a maintainer
# (OWNER, MEMBER, or COLLABORATOR).
# 2. OR it is a pull_request_review_comment event, the comment body has a line starting with "/review",
# and the commenter is a maintainer.
if: >
(github.event_name == 'pull_request' && !github.event.pull_request.draft &&
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)) ||
(github.event_name == 'pull_request_review_comment' &&
(startsWith(github.event.comment.body, '/review') || contains(github.event.comment.body, '\n/review')) &&
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
steps:
- name: Checkout PR Branch
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Checkout Reviewbot (Base Branch)
uses: actions/checkout@v7
with:
sparse-checkout: |
tools/private/reviewbot
path: reviewbot
- name: Install uv
uses: astral-sh/setup-uv@v8.3.0
- name: Set up Python
run: uv python install 3.13
- name: Install Dependencies
run: |
uv pip install google-antigravity requests
- name: Run Antigravity Review
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
uv run reviewbot/tools/private/reviewbot/antigravity_review.py \
--prompt reviewbot/tools/private/reviewbot/prompt.txt