@@ -165,7 +165,10 @@ export async function isAuthenticated(): Promise<boolean> {
165165 * specification is installed.
166166 * @returns The path of the installed tool.
167167 */
168- export async function installGcloudSDK ( version : string , skipToolCache ?: boolean ) : Promise < string > {
168+ export async function installGcloudSDK (
169+ version : string ,
170+ useToolCache : boolean = false ,
171+ ) : Promise < string > {
169172 // Retrieve the release corresponding to the specified version and OS
170173 const osPlat = os . platform ( ) ;
171174 const osArch = os . arch ( ) ;
@@ -181,22 +184,23 @@ export async function installGcloudSDK(version: string, skipToolCache?: boolean)
181184 }
182185
183186 // Either cache the tool or just add it directly to the path.
184- if ( skipToolCache ) {
185- // Caching the tool on disk takes a really long time, and it's not clear
186- // whether it's even valuable since it's ONLY cached on disk on the runner.
187- // For GitHub-managed runners, that is useless since they are ephemeral.
188- //
189- // See https://github.com/google-github-actions/setup-gcloud/issues/701 for
190- // discussion, but it's actually faster to skip the caching and just add the
191- // tool directly to the path.
192- const toolRoot = path . join ( extPath , 'google-cloud-sdk' ) ;
193- core . addPath ( path . join ( toolRoot , 'bin' ) ) ;
194- return toolRoot ;
195- } else {
187+ //
188+ // Caching the tool on disk takes a really long time, and it's not clear
189+ // whether it's even valuable since it's ONLY cached on disk on the runner.
190+ // For GitHub-managed runners, that is useless since they are ephemeral.
191+ //
192+ // See https://github.com/google-github-actions/setup-gcloud/issues/701 for
193+ // discussion, but it's actually faster to skip the caching and just add the
194+ // tool directly to the path.
195+ if ( useToolCache ) {
196196 const toolRoot = path . join ( extPath , 'google-cloud-sdk' ) ;
197197 const cachedToolRoot = await toolCache . cacheDir ( toolRoot , 'gcloud' , resolvedVersion , osArch ) ;
198198 core . addPath ( path . join ( cachedToolRoot , 'bin' ) ) ;
199199 return cachedToolRoot ;
200+ } else {
201+ const toolRoot = path . join ( extPath , 'google-cloud-sdk' ) ;
202+ core . addPath ( path . join ( toolRoot , 'bin' ) ) ;
203+ return toolRoot ;
200204 }
201205}
202206
0 commit comments