II.
Page JSON
Structured · livepage:docs-github-actions-setup-gemini-cli
Using Babysitter with Gemini CLI GitHub Actions json
Inspect the normalized record payload exactly as the atlas UI reads it.
{
"id": "page:docs-github-actions-setup-gemini-cli",
"_kind": "Page",
"_file": "wiki/docs/github-actions-setup-gemini-cli.md",
"_cluster": "wiki",
"attributes": {
"nodeKind": "Page",
"sourcePath": "docs/github-actions-setup-gemini-cli.md",
"sourceKind": "repo-docs",
"title": "Using Babysitter with Gemini CLI GitHub Actions",
"displayName": "Using Babysitter with Gemini CLI GitHub Actions",
"slug": "docs/github-actions-setup-gemini-cli",
"articlePath": "wiki/docs/github-actions-setup-gemini-cli.md",
"article": "\n# Using Babysitter with Gemini CLI GitHub Actions\n\nThis guide explains how to integrate the Babysitter plugin with [Google's Gemini CLI GitHub Action](https://github.com/google-github-actions/run-gemini-cli) for automated orchestration workflows in your CI/CD pipeline.\n\n## Overview\n\nThe Babysitter plugin enables deterministic, event-sourced workflow orchestration for Gemini CLI. When combined with GitHub Actions, you can automate complex multi-step development processes with quality gates, human approval checkpoints, and iterative refinement.\n\nGemini CLI uses the `google-github-actions/run-gemini-cli@v1` action, which supports multiple authentication methods including API keys, Vertex AI, and GCP Workload Identity Federation.\n\n## Quick Start\n\n### Basic Setup (API Key)\n\n```yaml\nname: Gemini CLI with Babysitter\n\non:\n issue_comment:\n types: [created]\n issues:\n types: [opened, assigned]\n\njobs:\n gemini:\n if: |\n (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@gemini')) ||\n (github.event_name == 'issues' && contains(github.event.issue.body, '@gemini'))\n runs-on: ubuntu-latest\n permissions:\n contents: write\n pull-requests: write\n issues: write\n steps:\n - name: Checkout repository\n uses: actions/checkout@v4\n with:\n fetch-depth: 1\n\n - name: Install Babysitter SDK\n run: npm install -g @a5c-ai/babysitter-sdk\n\n - name: Install Babysitter Gemini Extension\n run: |\n babysitter harness:install-plugin gemini-cli\n echo \"BABYSITTER_EXTENSION_PATH=$HOME/.gemini/extensions/babysitter-gemini\" >> \"$GITHUB_ENV\"\n\n - name: Run Gemini CLI with Babysitter\n uses: google-github-actions/run-gemini-cli@v1\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n extensions: '[\"babysitter\"]'\n prompt: |\n You have the babysitter CLI available for orchestration.\n\n ${{ github.event.comment.body || github.event.issue.body }}\n```\n\n### Setup with GCP Workload Identity Federation\n\nFor production workloads using Vertex AI:\n\n```yaml\njobs:\n gemini:\n runs-on: ubuntu-latest\n permissions:\n contents: write\n pull-requests: write\n issues: write\n id-token: write # Required for WIF\n steps:\n - name: Checkout repository\n uses: actions/checkout@v4\n\n - name: Authenticate to Google Cloud\n uses: google-github-actions/auth@v2\n with:\n workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}\n service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}\n\n - name: Install Babysitter SDK\n run: npm install -g @a5c-ai/babysitter-sdk\n\n - name: Run Gemini CLI with Babysitter\n uses: google-github-actions/run-gemini-cli@v1\n with:\n gcp_workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}\n gcp_project_id: ${{ vars.GCP_PROJECT_ID }}\n gcp_service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}\n use_vertex_ai: \"true\"\n prompt: \"Your task description\"\n```\n\nFor comprehensive setup instructions, see the [Gemini CLI Action README](https://github.com/google-github-actions/run-gemini-cli).\n\n## Configuration Options\n\n### Gemini CLI Action Parameters\n\n```yaml\n- uses: google-github-actions/run-gemini-cli@v1\n with:\n # Authentication (choose one method)\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }} # Simple API key\n # -- OR GCP Workload Identity Federation: --\n gcp_workload_identity_provider: \"projects/.../providers/...\"\n gcp_project_id: \"my-project\"\n gcp_service_account: \"sa@my-project.iam.gserviceaccount.com\"\n use_vertex_ai: \"false\" # Use Vertex AI backend\n\n # Task\n prompt: \"Your task description\"\n\n # Optional\n gemini_model: \"\" # Model override\n gemini_cli_version: \"latest\" # latest | preview | nightly | semver\n settings: '{\"codeExecution\": true}' # JSON settings for .gemini/settings.json\n extensions: '[\"@google/tool-name\"]' # JSON array of extensions to install\n gemini_debug: \"false\" # Enable debug logging + streaming\n upload_artifacts: \"false\" # Upload stdout/stderr as artifacts\n\n # GitHub context (auto-detected)\n github_pr_number: \"\"\n github_issue_number: \"\"\n```\n\n### Babysitter Extension\n\nThe Babysitter Gemini extension provides hooks and commands within the Gemini CLI session:\n\n```yaml\n- name: Install Babysitter Gemini Extension\n run: babysitter harness:install-plugin gemini-cli\n\n- uses: google-github-actions/run-gemini-cli@v1\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n extensions: '[\"babysitter\"]'\n```\n\n## Workflow Examples\n\n### Example 1: PR Review with Quality Gates\n\n```yaml\nname: Babysitter PR Review (Gemini)\n\non:\n pull_request:\n types: [opened, synchronize, ready_for_review, reopened]\n\njobs:\n review:\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n steps:\n - name: Checkout repository\n uses: actions/checkout@v4\n with:\n fetch-depth: 1\n\n - name: Install Babysitter SDK\n run: npm install -g @a5c-ai/babysitter-sdk\n\n - name: Run Babysitter PR Review\n uses: google-github-actions/run-gemini-cli@v1\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n prompt: |\n You have the babysitter CLI available for orchestration.\n Orchestrate a thorough code review using TDD Quality Convergence methodology.\n\n REPO: ${{ github.repository }}\n PR NUMBER: ${{ github.event.pull_request.number }}\n\n Analyze the PR changes for:\n - Code quality and best practices\n - Security vulnerabilities\n - Performance implications\n - Test coverage\n```\n\n### Example 2: Feature Development with TDD\n\n```yaml\nname: Babysitter TDD Feature (Gemini)\n\non:\n issues:\n types: [labeled]\n\njobs:\n develop:\n if: github.event.label.name == 'feature-request'\n runs-on: ubuntu-latest\n timeout-minutes: 30\n permissions:\n contents: write\n pull-requests: write\n issues: write\n steps:\n - name: Checkout repository\n uses: actions/checkout@v4\n with:\n fetch-depth: 0\n\n - name: Install Babysitter SDK\n run: npm install -g @a5c-ai/babysitter-sdk\n\n - name: Run Babysitter TDD\n uses: google-github-actions/run-gemini-cli@v1\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n prompt: |\n You have the babysitter CLI available for orchestration.\n Implement the feature described in issue #${{ github.event.issue.number }} using TDD Quality Convergence methodology.\n\n REPO: ${{ github.repository }}\n ISSUE NUMBER: ${{ github.event.issue.number }}\n\n The process should:\n 1. Write failing tests first\n 2. Implement minimal code to pass tests\n 3. Refactor for quality\n 4. Iterate until 80% quality threshold is met\n\n Create a PR when complete.\n```\n\n### Example 3: GSD Quick Tasks\n\n```yaml\nname: Babysitter GSD (Gemini)\n\non:\n issue_comment:\n types: [created]\n\njobs:\n gsd:\n if: contains(github.event.comment.body, '/gsd')\n runs-on: ubuntu-latest\n timeout-minutes: 15\n permissions:\n contents: write\n pull-requests: write\n issues: write\n steps:\n - name: Checkout repository\n uses: actions/checkout@v4\n with:\n fetch-depth: 1\n\n - name: Install Babysitter SDK\n run: npm install -g @a5c-ai/babysitter-sdk\n\n - name: Run Babysitter GSD\n uses: google-github-actions/run-gemini-cli@v1\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n prompt: |\n You have the babysitter CLI available.\n Use GSD methodology for the following task:\n\n ${{ github.event.comment.body }}\n\n Focus on rapid, working implementation with minimal overhead.\n```\n\n### Example 4: With Gemini CLI Settings\n\n```yaml\n- uses: google-github-actions/run-gemini-cli@v1\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n settings: |\n {\n \"codeExecution\": true,\n \"sandbox\": true\n }\n prompt: \"Implement and test the feature\"\n```\n\n## Authentication Methods\n\nGemini CLI supports three authentication approaches:\n\n| Method | When to Use | Required Fields |\n|--------|-------------|-----------------|\n| API Key | Simple setups, personal projects | `gemini_api_key` |\n| Vertex AI | Enterprise, GCP-integrated | `google_api_key` + `use_vertex_ai: true` |\n| Workload Identity Federation | Production CI/CD, no secrets needed | `gcp_workload_identity_provider`, `gcp_project_id`, `gcp_service_account` |\n\n## Environment Variables\n\n```yaml\n- uses: google-github-actions/run-gemini-cli@v1\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n prompt: \"...\"\n env:\n # Babysitter configuration\n BABYSITTER_RUNS_DIR: .a5c/runs\n BABYSITTER_MAX_ITERATIONS: 100\n BABYSITTER_QUALITY_THRESHOLD: 85\n BABYSITTER_LOG_LEVEL: debug\n BABYSITTER_EXTENSION_PATH: ~/.gemini/extensions/babysitter-gemini\n```\n\n## Artifacts and Outputs\n\n### Preserving Run State\n\n```yaml\n- uses: actions/upload-artifact@v4\n if: always()\n with:\n name: babysitter-runs\n path: .a5c/runs/\n retention-days: 7\n```\n\n### Gemini CLI Outputs\n\nThe action exposes `summary` and `error` outputs:\n\n```yaml\n- uses: google-github-actions/run-gemini-cli@v1\n id: gemini\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n prompt: \"...\"\n\n- name: Check results\n run: echo \"${{ steps.gemini.outputs.summary }}\"\n```\n\n### Built-in Artifact Upload\n\n```yaml\n- uses: google-github-actions/run-gemini-cli@v1\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n upload_artifacts: \"true\"\n prompt: \"...\"\n```\n\n## Best Practices\n\n### 1. Use Workload Identity Federation in Production\n\nAvoid storing API keys as secrets when possible. WIF is more secure and doesn't require secret rotation.\n\n### 2. Set Reasonable Iteration Limits\n\n```yaml\nenv:\n BABYSITTER_MAX_ITERATIONS: 50\n```\n\n### 3. Enable Debug Logging for Troubleshooting\n\n```yaml\n- uses: google-github-actions/run-gemini-cli@v1\n with:\n gemini_debug: \"true\"\n upload_artifacts: \"true\"\n```\n\n### 4. Handle Failures Gracefully\n\n```yaml\n- uses: google-github-actions/run-gemini-cli@v1\n id: gemini\n continue-on-error: true\n with:\n gemini_api_key: ${{ secrets.GEMINI_API_KEY }}\n prompt: \"...\"\n\n- name: Handle failure\n if: steps.gemini.outcome == 'failure'\n run: echo \"Gemini CLI run failed - check artifacts\"\n```\n\n## Troubleshooting\n\n### Babysitter CLI Not Found\n\nEnsure the SDK is installed before the Gemini CLI step:\n\n```yaml\n- name: Install Babysitter SDK\n run: npm install -g @a5c-ai/babysitter-sdk\n```\n\n### Authentication Failures\n\n1. For API key auth: verify `GEMINI_API_KEY` secret is set\n2. For WIF: ensure `id-token: write` permission is in the job\n3. For Vertex AI: verify project ID and service account\n\n### Runs Timing Out\n\n1. Reduce `BABYSITTER_MAX_ITERATIONS`\n2. Use simpler methodology (GSD vs TDD)\n3. Break task into smaller pieces\n\n## Related Documentation\n\n### Gemini CLI Action\n- [Gemini CLI Action Repository](https://github.com/google-github-actions/run-gemini-cli)\n- [GitHub Marketplace](https://github.com/marketplace/actions/run-gemini-cli)\n- [Gemini CLI](https://github.com/google-gemini/gemini-cli)\n\n### Babysitter Plugin\n- [Getting Started](./reference/GETTING_STARTED.md)\n- [Process Selection Guide](https://github.com/a5c-ai/babysitter/blob/main/docs/reference/PROCESS_SELECTION.md)\n- [Troubleshooting](https://github.com/a5c-ai/babysitter/blob/main/docs/reference/TROUBLESHOOTING.md)\n",
"documents": []
},
"outgoingEdges": [],
"incomingEdges": []
}