diff --git a/README.md b/README.md index cdb4c3e09..70d82d601 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,8 @@ go to the [Gemini Assistant workflow documentation](./examples/workflows/gemini- - gemini_api_key: _(Optional)_ The API key for the Gemini API. +- gemini_cli_package: _(Optional, default: `@google/gemini-cli`)_ The package name of the Gemini CLI to install. + - gemini_cli_version: _(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). - gemini_debug: _(Optional)_ Enable debug logging and output streaming. @@ -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 | diff --git a/action.yml b/action.yml index 7eccaf14b..df0610539 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -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 }}' @@ -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}" diff --git a/examples/workflows/gemini-assistant/gemini-invoke.yml b/examples/workflows/gemini-assistant/gemini-invoke.yml index c549de614..3a0da4cf8 100644 --- a/examples/workflows/gemini-assistant/gemini-invoke.yml +++ b/examples/workflows/gemini-assistant/gemini-invoke.yml @@ -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 }}' diff --git a/examples/workflows/gemini-assistant/gemini-plan-execute.yml b/examples/workflows/gemini-assistant/gemini-plan-execute.yml index b8796c217..020a9b33e 100644 --- a/examples/workflows/gemini-assistant/gemini-plan-execute.yml +++ b/examples/workflows/gemini-assistant/gemini-plan-execute.yml @@ -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 }}' diff --git a/examples/workflows/issue-triage/gemini-scheduled-triage.yml b/examples/workflows/issue-triage/gemini-scheduled-triage.yml index 8636cf7ab..2b7d549db 100644 --- a/examples/workflows/issue-triage/gemini-scheduled-triage.yml +++ b/examples/workflows/issue-triage/gemini-scheduled-triage.yml @@ -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 }}' diff --git a/examples/workflows/issue-triage/gemini-triage.yml b/examples/workflows/issue-triage/gemini-triage.yml index 480a2b0d6..27405e1c2 100644 --- a/examples/workflows/issue-triage/gemini-triage.yml +++ b/examples/workflows/issue-triage/gemini-triage.yml @@ -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 }}' diff --git a/examples/workflows/pr-review/gemini-review.yml b/examples/workflows/pr-review/gemini-review.yml index 58196b1f2..0b37d7596 100644 --- a/examples/workflows/pr-review/gemini-review.yml +++ b/examples/workflows/pr-review/gemini-review.yml @@ -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 }}'