run-gemini-cli: Automate AI-Powered Tasks with Gemini in GitHub Actions

Summary
The `run-gemini-cli` GitHub Action integrates the Gemini CLI into your development workflow, enabling AI-powered automation for critical coding tasks. It allows you to perform pull request reviews, triage issues, and conduct code analysis using Gemini conversationally within your GitHub repositories. This action acts as both an autonomous agent and an on-demand collaborator, streamlining various development processes.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
The run-gemini-cli
GitHub Action, developed by google-github-actions
, provides a seamless integration of the powerful Gemini CLI into your development workflows. This action empowers you to leverage Google's Gemini AI for a wide array of automated and on-demand coding tasks directly within your GitHub repositories. It functions as both an autonomous agent for routine tasks and an immediate collaborator for specific requests, significantly enhancing productivity and code quality. Use it for automated pull request reviews, efficient issue triage, in-depth code analysis, and even code modification.
Installation
Getting started with run-gemini-cli
is straightforward. Follow these quick steps to integrate Gemini into your repository:
- Get a Gemini API Key: Obtain your API key from Google AI Studio.
- Add it as a GitHub Secret: Store your API key as a repository secret named
GEMINI_API_KEY
in your repository's Settings > Secrets and variables > Actions. - Update your .gitignore: Add the following entries to prevent sensitive files from being committed:
# gemini-cli settings .gemini/ # GitHub App credentials gha-creds-*.json
- Choose a Workflow:
- Recommended: Use the Gemini CLI setup command in your terminal:
gemini /setup-github
- Manual: Copy pre-built workflows from the
examples/workflows
directory to your.github/workflows
directory, includinggemini-dispatch.yml
.
- Recommended: Use the Gemini CLI setup command in your terminal:
- Try it out!: Once set up, you can immediately test its capabilities.
Examples
run-gemini-cli
offers versatile workflows to automate and assist with various development tasks:
- Pull Request Review:
- Automatically review pull requests upon opening.
- Manually trigger a review by commenting
@gemini-cli /review
on an existing pull request.
- Issue Triage:
- Automatically triage new issues.
- Manually trigger triage by commenting
@gemini-cli /triage
on existing issues.
- General AI Assistance:
- Mention
@gemini-cli
followed by your request in any issue or pull request comment. - Examples:
@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 component
- Mention
Why Use It
This GitHub Action brings powerful AI capabilities directly into your development lifecycle, offering several key advantages:
- Automation: Automate routine tasks by triggering workflows based on events like issue creation or on a schedule.
- On-demand Collaboration: Get instant AI assistance by mentioning
@gemini-cli
in comments, making it an invaluable on-demand collaborator. - Extensible with Tools: Leverage Gemini models' tool-calling capabilities to interact with other CLIs, such as the GitHub CLI (
gh
). - Customizable: Tailor Gemini's behavior to your project's specific needs by creating a
GEMINI.md
file in your repository, providing project-specific instructions and context.
Links
- GitHub Repository: google-github-actions/run-gemini-cli
- Gemini CLI: google-gemini/gemini-cli
- Google AI Studio: Get your API Key