From 355de3df1d2097b22196adbf6917a2691cec5779 Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 14:56:20 +0530 Subject: [PATCH 01/11] Add google api key auth --- .github/workflows/gemini-pr-review.yml | 1 + action.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/gemini-pr-review.yml b/.github/workflows/gemini-pr-review.yml index beaddf437..aeaaabfb9 100644 --- a/.github/workflows/gemini-pr-review.yml +++ b/.github/workflows/gemini-pr-review.yml @@ -169,6 +169,7 @@ jobs: gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' + google_api_key: '${{ secrets.GOOGLE_API_KEY }}' use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' settings: |- { diff --git a/action.yml b/action.yml index a7e822471..83769ed0b 100644 --- a/action.yml +++ b/action.yml @@ -201,6 +201,7 @@ runs: GOOGLE_CLOUD_PROJECT: '${{ inputs.gcp_project_id }}' GOOGLE_CLOUD_LOCATION: '${{ inputs.gcp_location }}' GOOGLE_GENAI_USE_VERTEXAI: '${{ inputs.use_vertex_ai }}' + GOOGLE_API_KEY: '${{ inputs.google_api_key }}' GOOGLE_GENAI_USE_GCA: '${{ inputs.use_gemini_code_assist }}' GOOGLE_CLOUD_ACCESS_TOKEN: '${{steps.auth.outputs.access_token}}' PROMPT: '${{ inputs.prompt }}' From d481b86e66966c3f7fd385482bfd414f0c9975f6 Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 15:37:34 +0530 Subject: [PATCH 02/11] Add gemini model as parameter --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 83769ed0b..d5ab5c5ec 100644 --- a/action.yml +++ b/action.yml @@ -196,6 +196,7 @@ runs: exit 1 fi env: + GEMINI_MODEL: '${{ inputs.gemini_model }}' GEMINI_API_KEY: '${{ inputs.gemini_api_key }}' SURFACE: 'GitHub' GOOGLE_CLOUD_PROJECT: '${{ inputs.gcp_project_id }}' From cae2eaa60d3b83701c4d0d01c199760d605150a9 Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 16:31:05 +0530 Subject: [PATCH 03/11] Add google API key and gemini model parameters to workflows --- .github/workflows/gemini-cli.yml | 2 ++ .github/workflows/gemini-issue-automated-triage.yml | 2 ++ .github/workflows/gemini-issue-scheduled-triage.yml | 2 ++ .github/workflows/gemini-pr-review.yml | 1 + 4 files changed, 7 insertions(+) diff --git a/.github/workflows/gemini-cli.yml b/.github/workflows/gemini-cli.yml index be5cfcec3..9eda051b6 100644 --- a/.github/workflows/gemini-cli.yml +++ b/.github/workflows/gemini-cli.yml @@ -125,7 +125,9 @@ jobs: gcp_location: '${{ vars.GOOGLE_CLOUD_LOCATION }}' gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' + google_api_key: '${{ secrets.GOOGLE_API_KEY }}' use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' + gemini_model: '${{ vars.GEMINI_MODEL }}' settings: |- { "debug": ${{ fromJSON(env.DEBUG || env.ACTIONS_STEP_DEBUG || false) }}, diff --git a/.github/workflows/gemini-issue-automated-triage.yml b/.github/workflows/gemini-issue-automated-triage.yml index aea8f922a..a843c96e7 100644 --- a/.github/workflows/gemini-issue-automated-triage.yml +++ b/.github/workflows/gemini-issue-automated-triage.yml @@ -87,6 +87,8 @@ jobs: gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' + google_api_key: '${{ secrets.GOOGLE_API_KEY }}' + gemini_model: '${{ vars.GEMINI_MODEL }}' use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' settings: |- { diff --git a/.github/workflows/gemini-issue-scheduled-triage.yml b/.github/workflows/gemini-issue-scheduled-triage.yml index 13f2e0f6c..d433cd1f7 100644 --- a/.github/workflows/gemini-issue-scheduled-triage.yml +++ b/.github/workflows/gemini-issue-scheduled-triage.yml @@ -95,6 +95,8 @@ jobs: gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' + google_api_key: '${{ secrets.GOOGLE_API_KEY }}' + gemini_model: '${{ vars.GEMINI_MODEL }}' use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' settings: |- { diff --git a/.github/workflows/gemini-pr-review.yml b/.github/workflows/gemini-pr-review.yml index aeaaabfb9..abf7bca0a 100644 --- a/.github/workflows/gemini-pr-review.yml +++ b/.github/workflows/gemini-pr-review.yml @@ -170,6 +170,7 @@ jobs: gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' google_api_key: '${{ secrets.GOOGLE_API_KEY }}' + gemini_model: '${{ vars.GEMINI_MODEL }}' use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' settings: |- { From d2867fa35e38e5a0edc57d9f08111a1f2e81a380 Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 16:39:11 +0530 Subject: [PATCH 04/11] Update readme --- README.md | 76 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index b6ca2d506..bdf180f5c 100644 --- a/README.md +++ b/README.md @@ -45,15 +45,19 @@ Use it to perform GitHub pull request reviews, triage issues, perform code analy Get started with Gemini CLI in your repository in just a few minutes: ### 1. Get a Gemini API Key + Obtain your API key from [Google AI Studio] with generous free-of-charge quotas ### 2. Add it as a GitHub Secret + Store your API key as a secret named `GEMINI_API_KEY` in your repository: + - Go to your repository's **Settings > Secrets and variables > Actions** - Click **New repository secret** - Name: `GEMINI_API_KEY`, Value: your API key ### 3. Update your .gitignore + Add the following entries to your `.gitignore` file: ```gitignore @@ -65,9 +69,11 @@ gha-creds-*.json ``` ### 4. Choose a Workflow + You have two options to set up a workflow: **Option A: Use setup command (Recommended)** + 1. Start the Gemini CLI in your terminal: ```shell @@ -81,19 +87,23 @@ You have two options to set up a workflow: ``` **Option B: Manually copy workflows** + 1. Copy the pre-built workflows from the [`examples/workflows`](./examples/workflows) directory to your repository's `.github/workflows` directory. ### 5. Try it out! **Pull Request Review:** + - Open a pull request in your repository and wait for automatic review - Comment `@gemini-cli /review` on an existing pull request to manually trigger a review **Issue Triage:** + - Open an issue and wait for automatic triage - Comment `@gemini-cli /triage` on existing issues to manually trigger triaging **General AI Assistance:** + - In any issue or pull request, mention `@gemini-cli` followed by your request - Examples: - `@gemini-cli explain this code change` @@ -117,7 +127,7 @@ 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](./examples/workflows/pr-review). -There is a [known issue](https://github.com/google-github-actions/run-gemini-cli/issues/169) that action bot may approve the PR occasionally, +There is a [known issue](https://github.com/google-github-actions/run-gemini-cli/issues/169) that action bot may approve the PR occasionally, to avoid this situation as org owner you can restrict who can approve the PR following [Code Review Limits](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-pull-request-reviews-in-your-repository#enabling-code-review-limits). @@ -132,27 +142,26 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). -- prompt: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Gemini CLI's [`--prompt` argument](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#command-line-arguments). +- prompt: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Gemini CLI's [`--prompt` argument](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#command-line-arguments). -- 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](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#settings-files). +- 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](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#settings-files). -- gemini_api_key: _(Optional)_ The API key for the Gemini API. +- gemini*api_key: *(Optional)\_ The API key for the Gemini API. -- gcp_project_id: _(Optional)_ The Google Cloud project ID. +- gcp*project_id: *(Optional)\_ The Google Cloud project ID. -- gcp_location: _(Optional)_ The Google Cloud location. +- gcp*location: *(Optional)\_ The Google Cloud location. -- gcp_workload_identity_provider: _(Optional)_ The Google Cloud Workload Identity Provider. +- gcp*workload_identity_provider: *(Optional)\_ The Google Cloud Workload Identity Provider. -- gcp_service_account: _(Optional)_ The Google Cloud service account email. +- gcp*service_account: *(Optional)\_ The Google Cloud service account email. -- use_vertex_ai: _(Optional, default: `false`)_ A flag to indicate if Vertex AI should be used. +- use*vertex_ai: *(Optional, default: `false`)\_ A flag to indicate if Vertex AI should be used. -- use_gemini_code_assist: _(Optional, default: `false`)_ A flag to indicate if Gemini Code Assist should be used. - -- gemini_cli_version: _(Optional, default: `latest`)_ The version of the Gemini CLI to install. +- use*gemini_code_assist: *(Optional, default: `false`)\_ A flag to indicate if Gemini Code Assist should be used. +- gemini*cli_version: *(Optional, default: `latest`)\_ The version of the Gemini CLI to install. @@ -160,8 +169,7 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). -- `summary`: The summarized output from the Gemini CLI execution. - +- `summary`: The summarized output from the Gemini CLI execution. @@ -169,22 +177,23 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). 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_CLI_VERSION` | Controls which version of the Gemini CLI is installed. | Variable | No | Pinning the CLI version | -| `GCP_WIF_PROVIDER` | Full resource name of the Workload Identity Provider. | Variable | No | Using Google Cloud | -| `GOOGLE_CLOUD_PROJECT` | Google Cloud project for inference and observability. | Variable | No | Using Google Cloud | -| `SERVICE_ACCOUNT_EMAIL` | Google Cloud service account email address. | Variable | No | Using Google Cloud | -| `GOOGLE_CLOUD_LOCATION` | Region of the Google Cloud project. | Variable | No | Using Google Cloud | -| `GOOGLE_GENAI_USE_VERTEXAI` | Set to `true` to use Vertex AI | Variable | No | Using Vertex AI | -| `GOOGLE_GENAI_USE_GCA` | Set to `true` to use Gemini Code Assist | Variable | No | Using Gemini Code Assist | -| `APP_ID` | GitHub App ID for custom authentication. | Variable | No | Using a custom GitHub App | - +| Name | Description | Type | Required | When Required | +| --------------------------- | ------------------------------------------------------ | -------- | -------- | -------------------------------- | +| `GEMINI_CLI_VERSION` | Controls which version of the Gemini CLI is installed. | Variable | No | Pinning the CLI version | +| `GCP_WIF_PROVIDER` | Full resource name of the Workload Identity Provider. | Variable | No | Using Google Cloud | +| `GOOGLE_CLOUD_PROJECT` | Google Cloud project for inference and observability. | Variable | No | Using Google Cloud | +| `SERVICE_ACCOUNT_EMAIL` | Google Cloud service account email address. | Variable | No | Using Google Cloud | +| `GOOGLE_CLOUD_LOCATION` | Region of the Google Cloud project. | Variable | No | Using Google Cloud | +| `GOOGLE_GENAI_USE_VERTEXAI` | Set to `true` to use Vertex AI | Variable | No | Using Vertex AI | +| `GOOGLE_GENAI_USE_GCA` | Set to `true` to use Gemini Code Assist | Variable | No | Using Gemini Code Assist | +| `APP_ID` | GitHub App ID for custom authentication. | Variable | No | Using a custom GitHub App | +| `GEMINI_MODEL` | Specify the model to use for Gemini API calls. | Variable | No | Setting the model for Gemini API | To add a repository variable: -1) Go to your repository's **Settings > Secrets and variables > Actions > New variable**. -2) Enter the variable name and value. -3) Save. + +1. Go to your repository's **Settings > Secrets and variables > Actions > New variable**. +2. Enter the variable name and value. +3. Save. For details about repository variables, refer to the [GitHub documentation on variables][variables]. @@ -192,10 +201,11 @@ For details about repository variables, refer to the [GitHub documentation on va You can set the following secrets in your repository: -| Name | Description | Required | When Required | -| ----------------- | --------------------------------------------- | -------- | ----------------------------- | -| `GEMINI_API_KEY` | Your Gemini API key from Google AI Studio. | No | You don't have a GCP project. | -| `APP_PRIVATE_KEY` | Private key for your GitHub App (PEM format). | No | Using a custom GitHub App. | +| Name | Description | Required | When Required | +| ----------------- | --------------------------------------------- | -------- | ------------------------------------- | +| `GEMINI_API_KEY` | Your Gemini API key from Google AI Studio. | No | You don't have a GCP project. | +| `APP_PRIVATE_KEY` | Private key for your GitHub App (PEM format). | No | Using a custom GitHub App. | +| `GOOGLE_API_KEY` | Your Google API Key to use with Vertex AI. | No | You have a express Vertex AI account. | To add a secret: From 3e3f527e4eefdb330f83fd71119b322396340eba Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 16:41:40 +0530 Subject: [PATCH 05/11] Update readme --- README.md | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index bdf180f5c..b6b4a3832 100644 --- a/README.md +++ b/README.md @@ -45,19 +45,15 @@ Use it to perform GitHub pull request reviews, triage issues, perform code analy Get started with Gemini CLI in your repository in just a few minutes: ### 1. Get a Gemini API Key - Obtain your API key from [Google AI Studio] with generous free-of-charge quotas ### 2. Add it as a GitHub Secret - Store your API key as a secret named `GEMINI_API_KEY` in your repository: - - Go to your repository's **Settings > Secrets and variables > Actions** - Click **New repository secret** - Name: `GEMINI_API_KEY`, Value: your API key ### 3. Update your .gitignore - Add the following entries to your `.gitignore` file: ```gitignore @@ -69,11 +65,9 @@ gha-creds-*.json ``` ### 4. Choose a Workflow - You have two options to set up a workflow: **Option A: Use setup command (Recommended)** - 1. Start the Gemini CLI in your terminal: ```shell @@ -87,23 +81,19 @@ You have two options to set up a workflow: ``` **Option B: Manually copy workflows** - 1. Copy the pre-built workflows from the [`examples/workflows`](./examples/workflows) directory to your repository's `.github/workflows` directory. ### 5. Try it out! **Pull Request Review:** - - Open a pull request in your repository and wait for automatic review - Comment `@gemini-cli /review` on an existing pull request to manually trigger a review **Issue Triage:** - - Open an issue and wait for automatic triage - Comment `@gemini-cli /triage` on existing issues to manually trigger triaging **General AI Assistance:** - - In any issue or pull request, mention `@gemini-cli` followed by your request - Examples: - `@gemini-cli explain this code change` @@ -142,26 +132,27 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). -- prompt: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Gemini CLI's [`--prompt` argument](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#command-line-arguments). -- 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](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#settings-files). +- prompt: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Gemini CLI's [`--prompt` argument](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#command-line-arguments). + +- 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](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#settings-files). -- gemini*api_key: *(Optional)\_ The API key for the Gemini API. +- gemini_api_key: _(Optional)_ The API key for the Gemini API. -- gcp*project_id: *(Optional)\_ The Google Cloud project ID. +- gcp_project_id: _(Optional)_ The Google Cloud project ID. -- gcp*location: *(Optional)\_ The Google Cloud location. +- gcp_location: _(Optional)_ The Google Cloud location. -- gcp*workload_identity_provider: *(Optional)\_ The Google Cloud Workload Identity Provider. +- gcp_workload_identity_provider: _(Optional)_ The Google Cloud Workload Identity Provider. -- gcp*service_account: *(Optional)\_ The Google Cloud service account email. +- gcp_service_account: _(Optional)_ The Google Cloud service account email. -- use*vertex_ai: *(Optional, default: `false`)\_ A flag to indicate if Vertex AI should be used. +- use_vertex_ai: _(Optional, default: `false`)_ A flag to indicate if Vertex AI should be used. -- use*gemini_code_assist: *(Optional, default: `false`)\_ A flag to indicate if Gemini Code Assist should be used. +- use_gemini_code_assist: _(Optional, default: `false`)_ A flag to indicate if Gemini Code Assist should be used. -- gemini*cli_version: *(Optional, default: `latest`)\_ The version of the Gemini CLI to install. +- gemini_cli_version: _(Optional, default: `latest`)_ The version of the Gemini CLI to install. From b90eefa41c00312bd59af8b0d5785a73f3d37c68 Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 16:43:23 +0530 Subject: [PATCH 06/11] Fix spacing in readme --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b6b4a3832..d4007b7aa 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ 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](./examples/workflows/pr-review). -There is a [known issue](https://github.com/google-github-actions/run-gemini-cli/issues/169) that action bot may approve the PR occasionally, +There is a [known issue](https://github.com/google-github-actions/run-gemini-cli/issues/169) that action bot may approve the PR occasionally, to avoid this situation as org owner you can restrict who can approve the PR following [Code Review Limits](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-pull-request-reviews-in-your-repository#enabling-code-review-limits). @@ -132,7 +132,6 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). - - prompt: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Gemini CLI's [`--prompt` argument](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#command-line-arguments). - settings: _(Optional)_ A JSON string written to `.gemini/settings.json` to configure the CLI's _project_ settings. @@ -162,6 +161,7 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). - `summary`: The summarized output from the Gemini CLI execution. + ### Repository Variables @@ -181,7 +181,6 @@ We recommend setting the following values as repository variables so they can be | `GEMINI_MODEL` | Specify the model to use for Gemini API calls. | Variable | No | Setting the model for Gemini API | To add a repository variable: - 1. Go to your repository's **Settings > Secrets and variables > Actions > New variable**. 2. Enter the variable name and value. 3. Save. From 64f2f0bb0cefca440349568c9f595b70dda0517c Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 16:44:58 +0530 Subject: [PATCH 07/11] Update readme --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d4007b7aa..6b6b56fe8 100644 --- a/README.md +++ b/README.md @@ -153,13 +153,14 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). - gemini_cli_version: _(Optional, default: `latest`)_ The version of the Gemini CLI to install. + ### Outputs -- `summary`: The summarized output from the Gemini CLI execution. +- `summary`: The summarized output from the Gemini CLI execution. @@ -181,9 +182,9 @@ We recommend setting the following values as repository variables so they can be | `GEMINI_MODEL` | Specify the model to use for Gemini API calls. | Variable | No | Setting the model for Gemini API | To add a repository variable: -1. Go to your repository's **Settings > Secrets and variables > Actions > New variable**. -2. Enter the variable name and value. -3. Save. +1) Go to your repository's **Settings > Secrets and variables > Actions > New variable**. +2) Enter the variable name and value. +3) Save. For details about repository variables, refer to the [GitHub documentation on variables][variables]. From f5d42959351340f84befd6d52959ed0765829b21 Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 18:09:33 +0530 Subject: [PATCH 08/11] Add gemini_model and google_api_key inputs to action.yml --- action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/action.yml b/action.yml index d5ab5c5ec..288e4e1df 100644 --- a/action.yml +++ b/action.yml @@ -55,6 +55,12 @@ inputs: description: 'The version of the Gemini CLI to install.' required: false default: 'latest' + gemini_model: + description: 'The model to use for Gemini API calls.' + required: false + google_api_key: + description: 'The Vertex AI API key to use with Gemini.' + required: false outputs: summary: From 74a9da19530ab7e39bb216f2a9d2c51db90b9697 Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 20:40:01 +0530 Subject: [PATCH 09/11] Remove gemini_model and run docs --- .github/workflows/gemini-cli.yml | 1 - .../gemini-issue-automated-triage.yml | 1 - .../gemini-issue-scheduled-triage.yml | 1 - .github/workflows/gemini-pr-review.yml | 1 - README.md | 66 +++++++++++-------- action.yml | 4 -- 6 files changed, 39 insertions(+), 35 deletions(-) diff --git a/.github/workflows/gemini-cli.yml b/.github/workflows/gemini-cli.yml index 9eda051b6..85db7b840 100644 --- a/.github/workflows/gemini-cli.yml +++ b/.github/workflows/gemini-cli.yml @@ -127,7 +127,6 @@ jobs: use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' google_api_key: '${{ secrets.GOOGLE_API_KEY }}' use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' - gemini_model: '${{ vars.GEMINI_MODEL }}' settings: |- { "debug": ${{ fromJSON(env.DEBUG || env.ACTIONS_STEP_DEBUG || false) }}, diff --git a/.github/workflows/gemini-issue-automated-triage.yml b/.github/workflows/gemini-issue-automated-triage.yml index a843c96e7..71087cd42 100644 --- a/.github/workflows/gemini-issue-automated-triage.yml +++ b/.github/workflows/gemini-issue-automated-triage.yml @@ -88,7 +88,6 @@ jobs: gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' google_api_key: '${{ secrets.GOOGLE_API_KEY }}' - gemini_model: '${{ vars.GEMINI_MODEL }}' use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' settings: |- { diff --git a/.github/workflows/gemini-issue-scheduled-triage.yml b/.github/workflows/gemini-issue-scheduled-triage.yml index d433cd1f7..fd42fa6a1 100644 --- a/.github/workflows/gemini-issue-scheduled-triage.yml +++ b/.github/workflows/gemini-issue-scheduled-triage.yml @@ -96,7 +96,6 @@ jobs: gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' google_api_key: '${{ secrets.GOOGLE_API_KEY }}' - gemini_model: '${{ vars.GEMINI_MODEL }}' use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' settings: |- { diff --git a/.github/workflows/gemini-pr-review.yml b/.github/workflows/gemini-pr-review.yml index abf7bca0a..aeaaabfb9 100644 --- a/.github/workflows/gemini-pr-review.yml +++ b/.github/workflows/gemini-pr-review.yml @@ -170,7 +170,6 @@ jobs: gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' google_api_key: '${{ secrets.GOOGLE_API_KEY }}' - gemini_model: '${{ vars.GEMINI_MODEL }}' use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' settings: |- { diff --git a/README.md b/README.md index 6b6b56fe8..0f677b746 100644 --- a/README.md +++ b/README.md @@ -45,15 +45,19 @@ Use it to perform GitHub pull request reviews, triage issues, perform code analy Get started with Gemini CLI in your repository in just a few minutes: ### 1. Get a Gemini API Key + Obtain your API key from [Google AI Studio] with generous free-of-charge quotas ### 2. Add it as a GitHub Secret + Store your API key as a secret named `GEMINI_API_KEY` in your repository: + - Go to your repository's **Settings > Secrets and variables > Actions** - Click **New repository secret** - Name: `GEMINI_API_KEY`, Value: your API key ### 3. Update your .gitignore + Add the following entries to your `.gitignore` file: ```gitignore @@ -65,9 +69,11 @@ gha-creds-*.json ``` ### 4. Choose a Workflow + You have two options to set up a workflow: **Option A: Use setup command (Recommended)** + 1. Start the Gemini CLI in your terminal: ```shell @@ -81,19 +87,23 @@ You have two options to set up a workflow: ``` **Option B: Manually copy workflows** + 1. Copy the pre-built workflows from the [`examples/workflows`](./examples/workflows) directory to your repository's `.github/workflows` directory. ### 5. Try it out! **Pull Request Review:** + - Open a pull request in your repository and wait for automatic review - Comment `@gemini-cli /review` on an existing pull request to manually trigger a review **Issue Triage:** + - Open an issue and wait for automatic triage - Comment `@gemini-cli /triage` on existing issues to manually trigger triaging **General AI Assistance:** + - In any issue or pull request, mention `@gemini-cli` followed by your request - Examples: - `@gemini-cli explain this code change` @@ -117,7 +127,7 @@ 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](./examples/workflows/pr-review). -There is a [known issue](https://github.com/google-github-actions/run-gemini-cli/issues/169) that action bot may approve the PR occasionally, +There is a [known issue](https://github.com/google-github-actions/run-gemini-cli/issues/169) that action bot may approve the PR occasionally, to avoid this situation as org owner you can restrict who can approve the PR following [Code Review Limits](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-pull-request-reviews-in-your-repository#enabling-code-review-limits). @@ -132,27 +142,28 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). -- prompt: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Gemini CLI's [`--prompt` argument](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#command-line-arguments). +- prompt: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Gemini CLI's [`--prompt` argument](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#command-line-arguments). -- 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](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#settings-files). +- 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](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#settings-files). -- gemini_api_key: _(Optional)_ The API key for the Gemini API. +- gemini*api_key: *(Optional)\_ The API key for the Gemini API. -- gcp_project_id: _(Optional)_ The Google Cloud project ID. +- gcp*project_id: *(Optional)\_ The Google Cloud project ID. -- gcp_location: _(Optional)_ The Google Cloud location. +- gcp*location: *(Optional)\_ The Google Cloud location. -- gcp_workload_identity_provider: _(Optional)_ The Google Cloud Workload Identity Provider. +- gcp*workload_identity_provider: *(Optional)\_ The Google Cloud Workload Identity Provider. -- gcp_service_account: _(Optional)_ The Google Cloud service account email. +- gcp*service_account: *(Optional)\_ The Google Cloud service account email. -- use_vertex_ai: _(Optional, default: `false`)_ A flag to indicate if Vertex AI should be used. +- use*vertex_ai: *(Optional, default: `false`)\_ A flag to indicate if Vertex AI should be used. -- use_gemini_code_assist: _(Optional, default: `false`)_ A flag to indicate if Gemini Code Assist should be used. +- use*gemini_code_assist: *(Optional, default: `false`)\_ A flag to indicate if Gemini Code Assist should be used. -- gemini_cli_version: _(Optional, default: `latest`)_ The version of the Gemini CLI to install. +- gemini*cli_version: *(Optional, default: `latest`)\_ The version of the Gemini CLI to install. +- google*api_key: *(Optional)\_ The Vertex AI API key to use with Gemini. @@ -160,8 +171,9 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). -- `summary`: The summarized output from the Gemini CLI execution. +- `summary`: The summarized output from the Gemini CLI execution. +- `error`: The error output from the Gemini CLI execution, if any. @@ -169,22 +181,22 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). 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_CLI_VERSION` | Controls which version of the Gemini CLI is installed. | Variable | No | Pinning the CLI version | -| `GCP_WIF_PROVIDER` | Full resource name of the Workload Identity Provider. | Variable | No | Using Google Cloud | -| `GOOGLE_CLOUD_PROJECT` | Google Cloud project for inference and observability. | Variable | No | Using Google Cloud | -| `SERVICE_ACCOUNT_EMAIL` | Google Cloud service account email address. | Variable | No | Using Google Cloud | -| `GOOGLE_CLOUD_LOCATION` | Region of the Google Cloud project. | Variable | No | Using Google Cloud | -| `GOOGLE_GENAI_USE_VERTEXAI` | Set to `true` to use Vertex AI | Variable | No | Using Vertex AI | -| `GOOGLE_GENAI_USE_GCA` | Set to `true` to use Gemini Code Assist | Variable | No | Using Gemini Code Assist | -| `APP_ID` | GitHub App ID for custom authentication. | Variable | No | Using a custom GitHub App | -| `GEMINI_MODEL` | Specify the model to use for Gemini API calls. | Variable | No | Setting the model for Gemini API | +| Name | Description | Type | Required | When Required | +| --------------------------- | ------------------------------------------------------ | -------- | -------- | ------------------------- | +| `GEMINI_CLI_VERSION` | Controls which version of the Gemini CLI is installed. | Variable | No | Pinning the CLI version | +| `GCP_WIF_PROVIDER` | Full resource name of the Workload Identity Provider. | Variable | No | Using Google Cloud | +| `GOOGLE_CLOUD_PROJECT` | Google Cloud project for inference and observability. | Variable | No | Using Google Cloud | +| `SERVICE_ACCOUNT_EMAIL` | Google Cloud service account email address. | Variable | No | Using Google Cloud | +| `GOOGLE_CLOUD_LOCATION` | Region of the Google Cloud project. | Variable | No | Using Google Cloud | +| `GOOGLE_GENAI_USE_VERTEXAI` | Set to `true` to use Vertex AI | Variable | No | Using Vertex AI | +| `GOOGLE_GENAI_USE_GCA` | Set to `true` to use Gemini Code Assist | Variable | No | Using Gemini Code Assist | +| `APP_ID` | GitHub App ID for custom authentication. | Variable | No | Using a custom GitHub App | To add a repository variable: -1) Go to your repository's **Settings > Secrets and variables > Actions > New variable**. -2) Enter the variable name and value. -3) Save. + +1. Go to your repository's **Settings > Secrets and variables > Actions > New variable**. +2. Enter the variable name and value. +3. Save. For details about repository variables, refer to the [GitHub documentation on variables][variables]. diff --git a/action.yml b/action.yml index 288e4e1df..2f59e1116 100644 --- a/action.yml +++ b/action.yml @@ -55,9 +55,6 @@ inputs: description: 'The version of the Gemini CLI to install.' required: false default: 'latest' - gemini_model: - description: 'The model to use for Gemini API calls.' - required: false google_api_key: description: 'The Vertex AI API key to use with Gemini.' required: false @@ -202,7 +199,6 @@ runs: exit 1 fi env: - GEMINI_MODEL: '${{ inputs.gemini_model }}' GEMINI_API_KEY: '${{ inputs.gemini_api_key }}' SURFACE: 'GitHub' GOOGLE_CLOUD_PROJECT: '${{ inputs.gcp_project_id }}' From 14e98ee969c6acefab4095bddf7aaa77630897d2 Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 20:53:32 +0530 Subject: [PATCH 10/11] Revert markdown changes --- README.md | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 0f677b746..0c7ca98e8 100644 --- a/README.md +++ b/README.md @@ -142,28 +142,29 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). -- prompt: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Gemini CLI's [`--prompt` argument](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#command-line-arguments). +- prompt: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Gemini CLI's [`--prompt` argument](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#command-line-arguments). -- 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](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#settings-files). +- 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](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md#settings-files). -- gemini*api_key: *(Optional)\_ The API key for the Gemini API. +- gemini_api_key: _(Optional)_ The API key for the Gemini API. -- gcp*project_id: *(Optional)\_ The Google Cloud project ID. +- gcp_project_id: _(Optional)_ The Google Cloud project ID. -- gcp*location: *(Optional)\_ The Google Cloud location. +- gcp_location: _(Optional)_ The Google Cloud location. -- gcp*workload_identity_provider: *(Optional)\_ The Google Cloud Workload Identity Provider. +- gcp_workload_identity_provider: _(Optional)_ The Google Cloud Workload Identity Provider. -- gcp*service_account: *(Optional)\_ The Google Cloud service account email. +- gcp_service_account: _(Optional)_ The Google Cloud service account email. -- use*vertex_ai: *(Optional, default: `false`)\_ A flag to indicate if Vertex AI should be used. +- use_vertex_ai: _(Optional, default: `false`)_ A flag to indicate if Vertex AI should be used. -- use*gemini_code_assist: *(Optional, default: `false`)\_ A flag to indicate if Gemini Code Assist should be used. +- use_gemini_code_assist: _(Optional, default: `false`)_ A flag to indicate if Gemini Code Assist should be used. -- gemini*cli_version: *(Optional, default: `latest`)\_ The version of the Gemini CLI to install. +- gemini_cli_version: _(Optional, default: `latest`)_ The version of the Gemini CLI to install. + +- google_api_key: _(Optional)_ The Vertex AI API key to use with Gemini. -- google*api_key: *(Optional)\_ The Vertex AI API key to use with Gemini. @@ -171,9 +172,10 @@ go to the [Gemini CLI workflow documentation](./examples/workflows/gemini-cli). -- `summary`: The summarized output from the Gemini CLI execution. +- `summary`: The summarized output from the Gemini CLI execution. + +- `error`: The error output from the Gemini CLI execution, if any. -- `error`: The error output from the Gemini CLI execution, if any. From adddc2ee6d9fb5a9355cce04012d1a99a751152d Mon Sep 17 00:00:00 2001 From: Vivek Kairi Date: Wed, 20 Aug 2025 21:31:51 +0530 Subject: [PATCH 11/11] Update authentication documentation to include Vertex AI API key setup and usage instructions --- docs/authentication.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/authentication.md b/docs/authentication.md index 942f5208d..d1284423c 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -56,7 +56,30 @@ This is the simplest method and is suitable for projects that do not require Goo gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' ``` -### Method 2: Authenticating with Google Cloud +### Method 2: Authenticating with a Vertex AI API Key + +This method is used for quick setup using Vertex AI through Google Cloud Console + +#### Prerequisites + +- A Vertex AI API key from Google Cloud Console + +#### Setup + +1. **Create an API Key**: Obtain your Google Cloud [API key](https://cloud.google.com/vertex-ai/generative-ai/docs/start/api-keys?usertype=newuser) +2. **Add to GitHub Secrets**: In your GitHub repository, go to **Settings > Secrets and variables > Actions** and add a new repository secret with the name `GOOGLE_API_KEY` and paste your key as the value and create new variable with the name `GOOGLE_GENAI_USE_VERTEXAI` and set value as `true`. + +#### Example + +```yaml +- uses: 'google-github-actions/run-gemini-cli@v0' + with: + prompt: |- + Explain this code + google_api_key: '${{ secrets.GOOGLE_API_KEY }}' +``` + +### Method 3: Authenticating with Google Cloud **[Workload Identity Federation](https://cloud.google.com/iam/docs/workload-identity-federation)** is Google Cloud's preferred, keyless authentication method for GitHub Actions. It provides: