Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ go to the [Gemini Assistant workflow documentation](./examples/workflows/gemini-

- <a name="__input_gemini_api_key"></a><a href="#user-content-__input_gemini_api_key"><code>gemini_api_key</code></a>: _(Optional)_ The API key for the Gemini API.

- <a name="__input_gemini_cli_package"></a><a href="#user-content-__input_gemini_cli_package"><code>gemini_cli_package</code></a>: _(Optional, default: `@google/gemini-cli`)_ The package name of the Gemini CLI to install.

- <a name="__input_gemini_cli_version"></a><a href="#user-content-__input_gemini_cli_version"><code>gemini_cli_version</code></a>: _(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](https://github.com/google-gemini/gemini-cli/blob/main/docs/releases.md).

- <a name="__input_gemini_debug"></a><a href="#user-content-__input_gemini_debug"><code>gemini_debug</code></a>: _(Optional)_ Enable debug logging and output streaming.
Expand Down Expand Up @@ -218,6 +220,7 @@ We recommend setting the following values as repository variables so they can be
| Name | Description | Type | Required | When Required |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------- | -------- | ------------------------------ |
| `GEMINI_DEBUG` | Enables debug logging for the Gemini CLI. | Variable | No | Never |
| `GEMINI_CLI_PACKAGE` | Controls which package of the Gemini CLI is installed. | Variable | No | Custom CLI package |
| `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 |
Expand Down
12 changes: 9 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ inputs:
gemini_api_key:
description: 'The API key for the Gemini API.'
required: false
gemini_cli_package:
description: 'The package name of the Gemini CLI to install.'
required: false
default: '@google/gemini-cli'
gemini_cli_version:
description: '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](https://github.com/google-gemini/gemini-cli/blob/main/docs/releases.md).'
required: false
Expand Down Expand Up @@ -236,6 +240,7 @@ runs:
- name: 'Install Gemini CLI'
id: 'install'
env:
GEMINI_CLI_PACKAGE: '${{ inputs.gemini_cli_package }}'
GEMINI_CLI_VERSION: '${{ inputs.gemini_cli_version }}'
EXTENSIONS: '${{ inputs.extensions }}'
USE_PNPM: '${{ inputs.use_pnpm }}'
Expand All @@ -247,14 +252,15 @@ runs:
run: |-
set -euo pipefail

PACKAGE_NAME="${GEMINI_CLI_PACKAGE:-@google/gemini-cli}"
VERSION_INPUT="${GEMINI_CLI_VERSION:-latest}"

if [[ "${VERSION_INPUT}" == "latest" || "${VERSION_INPUT}" == "preview" || "${VERSION_INPUT}" == "nightly" || "${VERSION_INPUT}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.-]+)?(\+[a-zA-Z0-9\.-]+)?$ ]]; then
echo "Installing Gemini CLI from npm: @google/gemini-cli@${VERSION_INPUT}"
echo "Installing Gemini CLI from npm: ${PACKAGE_NAME}@${VERSION_INPUT}"
if [[ "${USE_PNPM}" == "true" ]]; then
pnpm add --silent --global @google/gemini-cli@"${VERSION_INPUT}"
pnpm add --silent --global "${PACKAGE_NAME}@${VERSION_INPUT}"
else
npm install --silent --no-audit --prefer-offline --global @google/gemini-cli@"${VERSION_INPUT}"
npm install --silent --no-audit --prefer-offline --global "${PACKAGE_NAME}@${VERSION_INPUT}"
fi
else
echo "Installing Gemini CLI from GitHub: github:google-gemini/gemini-cli#${VERSION_INPUT}"
Expand Down
1 change: 1 addition & 0 deletions examples/workflows/gemini-assistant/gemini-invoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}'
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
gemini_cli_package: '${{ vars.GEMINI_CLI_PACKAGE }}'
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'
gemini_debug: '${{ fromJSON(vars.GEMINI_DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}'
gemini_model: '${{ vars.GEMINI_MODEL }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}'
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
gemini_cli_package: '${{ vars.GEMINI_CLI_PACKAGE }}'
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'
gemini_debug: '${{ fromJSON(vars.GEMINI_DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}'
gemini_model: '${{ vars.GEMINI_MODEL }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}'
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
gemini_cli_package: '${{ vars.GEMINI_CLI_PACKAGE }}'
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'
gemini_debug: '${{ fromJSON(vars.GEMINI_DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}'
gemini_model: '${{ vars.GEMINI_MODEL }}'
Expand Down
1 change: 1 addition & 0 deletions examples/workflows/issue-triage/gemini-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}'
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
gemini_cli_package: '${{ vars.GEMINI_CLI_PACKAGE }}'
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'
gemini_debug: '${{ fromJSON(vars.GEMINI_DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}'
gemini_model: '${{ vars.GEMINI_MODEL }}'
Expand Down
1 change: 1 addition & 0 deletions examples/workflows/pr-review/gemini-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}'
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
gemini_cli_package: '${{ vars.GEMINI_CLI_PACKAGE }}'
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'
gemini_debug: '${{ fromJSON(vars.GEMINI_DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}'
gemini_model: '${{ vars.GEMINI_MODEL }}'
Expand Down