gemini.yml

Agent-mode Gemini CLI bot. Responds to @gemini and @gemini-cli mentions in issues, issue comments, PR review comments, and PR reviews, and also runs unattended on workflow_dispatch and schedule events.

Scope: agent mode

Responds to mentions, edits files, commits, pushes, and opens/updates pull requests on dedicated branches (gemini/issue-<N>-<ts>), matching claude.yml.

Requires contents: write, pull-requests: write, issues: write, id-token: write, and actions: write permissions on the calling job.

An @gemini review mention is routed to the dedicated reviewer (gemini-code-review.yml) instead of being answered in place.

Requires a GEMINI_API_KEY secret.

Inputs

Input Type Default Description
setup-r boolean true Install R before running Gemini CLI.
install-quarto boolean false Install Quarto so Gemini CLI can render .qmd files.
use-renv boolean false Restore R dependencies from renv.lock.
renv-cache-version string 'v1' Cache version suffix for setup-renv.
r-extra-packages string '' Extra R packages installed alongside DESCRIPTION dependencies.
apt-packages string '' Extra apt packages to install before setup.
pip-packages string '' Python packages to install with pip3.
checkout-submodules boolean false Check out git submodules.
eager-pr boolean false Open draft PR up front for issue triggers before Gemini runs.
reviewer string 'd-morrison' Reviewer login re-requested when Gemini pushes new commits.
mark-ready-for-review boolean true Mark draft PR ready for review when Gemini completes successfully.
prompt-addendum string '' Extra prompt instructions appended to the Gemini CLI prompt.
gemini-model string 'gemini-2.5-flash' Model passed to run-gemini-cli.
review-workflow-file string 'gemini-code-review.yml' Caller-repo workflow file dispatched on @gemini review mentions.

Secrets

Secret Required Description
GEMINI_API_KEY no Gemini API key. Without it the run reaches Gemini CLI and fails there.
WORKFLOW_TOKEN no Secret token for pushing workflow changes (optional; falls back to GITHUB_TOKEN).
SUBMODULES_TOKEN no Token used to check out private submodules.

Permissions

Grant contents: write, pull-requests: write, issues: write, id-token: write, and actions: write.

Example

# Copy to .github/workflows/gemini.yml in your repo.
name: Gemini CLI

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened, assigned]
  pull_request_review:
    types: [submitted]

jobs:
  gemini:
    if: |
      (github.event_name == 'issue_comment' && (contains(github.event.comment.body, '@gemini') || contains(github.event.comment.body, '@gemini-cli')) && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association))
    permissions:
      contents: write
      pull-requests: write
      issues: write
      id-token: write
      actions: write
    uses: Morrison-Lab/gha/.github/workflows/gemini.yml@v2
    secrets:
      GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
    # with:
    #   setup-r: false               # skip R setup for non-R repos
    #   install-quarto: true         # render .qmd files
    #   gemini-model: gemini-2.5-flash
    #   review-workflow-file: gemini-code-review.yml   # dispatched on `@gemini review`

See the examples/ directory for the full caller stub (gemini.yml), which carries the complete trusted-author if: for all four events.