Skip to content

Commit 57ee480

Browse files
authored
chore: add support to use pnpm instead of npm for install (#385)
This change introduces an option to install and use pnpm for installing the gemini-cli. In my own testing on a github actions runner pnpm installed gemini-cli@latest in 10 seconds whereas npm installed in 50 seconds. --------- Signed-off-by: Dylan Yurgionas <dcreey@google.com>
1 parent d38fea9 commit 57ee480

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ go to the [Gemini Assistant workflow documentation](./examples/workflows/gemini-
189189

190190
- <a name="__input_upload_artifacts"></a><a href="#user-content-__input_upload_artifacts"><code>upload_artifacts</code></a>: _(Optional, default: `false`)_ Whether to upload artifacts to the github action.
191191

192+
- <a name="__input_use_pnpm"></a><a href="#user-content-__input_use_pnpm"><code>use_pnpm</code></a>: _(Optional, default: `false`)_ Whether or not to use pnpm instead of npm to install gemini-cli
193+
192194

193195
<!-- END_AUTOGEN_INPUTS -->
194196

action.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ inputs:
8383
description: 'Whether to upload artifacts to the github action.'
8484
required: false
8585
default: 'false'
86+
use_pnpm:
87+
description: 'Whether or not to use pnpm instead of npm to install gemini-cli'
88+
required: false
89+
default: 'false'
8690

8791
outputs:
8892
summary:
@@ -201,11 +205,19 @@ runs:
201205
token_format: '${{ inputs.gcp_token_format }}'
202206
access_token_scopes: '${{ inputs.gcp_access_token_scopes }}'
203207

208+
- name: 'Install pnpm'
209+
if: |-
210+
${{ inputs.use_pnpm == 'true' }}
211+
uses: 'pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061' # ratchet:pnpm/action-setup@v4
212+
with:
213+
version: 10
214+
204215
- name: 'Install Gemini CLI'
205216
id: 'install'
206217
env:
207218
GEMINI_CLI_VERSION: '${{ inputs.gemini_cli_version }}'
208219
EXTENSIONS: '${{ inputs.extensions }}'
220+
USE_PNPM: '${{ inputs.use_pnpm }}'
209221
shell: 'bash'
210222
run: |-
211223
set -euo pipefail
@@ -214,7 +226,11 @@ runs:
214226
215227
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
216228
echo "Installing Gemini CLI from npm: @google/gemini-cli@${VERSION_INPUT}"
217-
npm install --silent --no-audit --prefer-offline --global @google/gemini-cli@"${VERSION_INPUT}"
229+
if [[ "${USE_PNPM}" == "true" ]]; then
230+
pnpm add --silent --global @google/gemini-cli@"${VERSION_INPUT}"
231+
else
232+
npm install --silent --no-audit --prefer-offline --global @google/gemini-cli@"${VERSION_INPUT}"
233+
fi
218234
else
219235
echo "Installing Gemini CLI from GitHub: github:google-gemini/gemini-cli#${VERSION_INPUT}"
220236
git clone https://github.com/google-gemini/gemini-cli.git

0 commit comments

Comments
 (0)