Get Gemini CLI running in your GitHub repository in under 10 minutes.
- A GitHub repository you control
- One of: Gemini API key, Google Cloud project, or GitHub App
Step 1: Get a free API key
- Visit https://aistudio.google.com/app/apikey
- Click "Create API Key"
- Copy the key
Step 2: Add to GitHub
- Go to your repository → Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
GEMINI_API_KEY - Paste your API key
- Save
Step 3: Create a workflow file
Create .github/workflows/gemini-basic.yml:
name: Gemini Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/run-gemini-cli@v0
with:
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
prompt: "Review this pull request for code quality and potential issues."Done! Open a PR to test it.
# Install Gemini CLI locally
gemini
# In the CLI terminal, run:
/setup-github
# Follow prompts to configure GitHub workflowsRun the setup script:
./scripts/setup_workload_identity.sh \
--repo "owner/your-repo" \
--project "your-gcp-project"The script handles all configuration automatically.
Once workflows are set up, mention Gemini in issues or PRs:
@gemini-cli explain this function
@gemini-cli /review check for security issues
@gemini-cli suggest improvements
Edit the workflow file to change:
- Prompt: What task Gemini should perform
- Triggers: When it runs (PR opened, schedule, etc.)
- Permissions: What access level it needs
Check examples/workflows for:
- PR review automation
- Issue triage automation
- Scheduled code analysis
- General-purpose assistant
API Key not working?
- Verify it's added to repository secrets (not variables)
- Check it's named exactly
GEMINI_API_KEY - Test the key in Google AI Studio
Workflow doesn't run?
- Check repository has
.github/workflows/directory - Verify the workflow syntax is valid (lint it in VS Code)
- Check Actions tab for error messages
Need help?
- See detailed docs in docs/ folder
- Check CONTRIBUTING.md for development info
- Open an issue on GitHub
- Customize prompts for your team's needs
- Set up multiple workflows for different tasks
- Create a GEMINI.md with project guidelines
- Explore extensions for custom capabilities