A GitHub Action invoking the Gemini CLI.
run-gemini-cli is a GitHub Action that integrates [Gemini] into your development workflow via the [Gemini CLI]. It acts both as an autonomous agent for critical routine coding tasks, and an on-demand collaborator you can quickly delegate work to.
Use it to perform GitHub pull request reviews, triage issues, perform code analysis and modification, and more using [Gemini] conversationally (e.g., @gemini-cli fix this issue) directly inside your GitHub repositories.
@gemini-cli /review).gh).GEMINI.md file in your repository to provide
project-specific instructions and context to [Gemini CLI].Get started with Gemini CLI in your repository in just a few minutes:
Obtain your API key from [Google AI Studio] with generous free-of-charge quotas
Store your API key as a secret named GEMINI_API_KEY in your repository:
GEMINI_API_KEY, Value: your API keyAdd the following entries to your .gitignore file:
# gemini-cli settings
.gemini/
# GitHub App credentials
gha-creds-*.jsonYou have two options to set up a workflow:
Option A: Use setup command (Recommended)
Start the Gemini CLI in your terminal:
geminiIn Gemini CLI in your terminal, type:
/setup-githubOption B: Manually copy workflows
examples/workflows directory to your repository's .github/workflows directory. Note: the gemini-dispatch.yml workflow must also be copied, which triggers the workflows to run.Pull Request Review:
@gemini-cli /review on an existing pull request to manually trigger a reviewIssue Triage:
@gemini-cli /triage on existing issues to manually trigger triagingGeneral AI Assistance:
@gemini-cli followed by your request@gemini-cli explain this code change@gemini-cli suggest improvements for this function@gemini-cli help me debug this error@gemini-cli write unit tests for this componentThis action provides several pre-built workflows for different use cases. Each workflow is designed to be copied into your repository's .github/workflows directory and customized as needed.
This workflow acts as a central dispatcher for Gemini CLI, routing requests to the appropriate workflow based on the triggering event and the command provided in the comment. For a detailed guide on how to set up the dispatch workflow, go to the Gemini Dispatch workflow documentation.
This action can be used to triage GitHub Issues automatically or on a schedule. For a detailed guide on how to set up the issue triage system, go to the GitHub Issue Triage workflow documentation.
This action can be used to automatically review pull requests when they are opened. For a detailed guide on how to set up the pull request review system, go to the GitHub PR Review workflow documentation.
This type of action can be used to invoke a general-purpose, conversational Gemini AI assistant within the pull requests and issues to perform a wide range of tasks. For a detailed guide on how to set up the general-purpose Gemini CLI workflow, go to the Gemini Assistant workflow documentation.
gcp_location: (Optional) The Google Cloud location.
gcp_project_id: (Optional) The Google Cloud project ID.
gcp_service_account: (Optional) The Google Cloud service account email.
gcp_workload_identity_provider: (Optional) The Google Cloud Workload Identity Provider.
gcp_token_format: (Optional, default: access_token) The token format for authentication. Set to "access_token" to generate access tokens (requires service account), or set to empty string for direct WIF. Can be "access_token" or "id_token".
gcp_access_token_scopes: (Optional, default: https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile) The access token scopes when using token_format "access_token". Comma-separated list of OAuth 2.0 scopes.
gemini_api_key: (Optional) The API key for the Gemini API.
gemini_cli_version: (Optional, default: latest) The version of the Gemini CLI to install. Can be "latest", "preview", "nightly", a specific version number, or a git branch, tag, or commit. For more information, see Gemini CLI releases.
gemini_debug: (Optional) Enable debug logging and output streaming.
gemini_model: (Optional) The model to use with Gemini.
google_api_key: (Optional) The Vertex AI API key to use with Gemini.
prompt: (Optional, default: You are a helpful assistant.) A string passed to the Gemini CLI's --prompt argument.
settings: (Optional) A JSON string written to .gemini/settings.json to configure the CLI's project settings.
For more details, see the documentation on settings files.
use_gemini_code_assist: (Optional, default: false) Whether to use Code Assist for Gemini model access instead of the default Gemini API key.
For more information, see the Gemini CLI documentation.
use_vertex_ai: (Optional, default: false) Whether to use Vertex AI for Gemini model access instead of the default Gemini API key.
For more information, see the Gemini CLI documentation.
extensions: (Optional) A list of Gemini CLI extensions to install.
upload_artifacts: (Optional, default: false) Whether to upload artifacts to the github action.
use_pnpm: (Optional, default: false) Whether or not to use pnpm instead of npm to install gemini-cli
workflow_name: (Optional, default: ${{ github.workflow }}) The GitHub workflow name, used for telemetry purposes.
github_pr_number: (Optional, default: ${{ github.event.pull_request.number }}) The Pull Request number the CLI is operating on. Defaults to the event payload.
github_issue_number: (Optional, default: ${{ github.event.issue.number }}) The Issue number (or comma-separated list of issue numbers) the CLI is operating on. Defaults to the event payload.
summary: The summarized output from the Gemini CLI execution.
error: The error output from the Gemini CLI execution, if any.
We recommend setting the following values as repository variables so they can be reused across all workflows. Alternatively, you can set them inline as action inputs in individual workflows or to override repository-level values.
| Name | Description | Type | Required | When Required |
|---|---|---|---|---|
GEMINI_DEBUG |
No open issues yet, or sync has not completed.