@@ -9696,14 +9696,18 @@ function isWIFCredFile(credFile) {
96969696/**
96979697 * Authenticates the gcloud tool using a service account key or WIF credential configuration
96989698 * discovered via GOOGLE_GHA_CREDS_PATH environment variable. An optional serviceAccountKey
9699- * param is supported for legacy Actions.
9699+ * param is supported for legacy Actions and will take precedence over GOOGLE_GHA_CREDS_PATH .
97009700 *
97019701 * @param serviceAccountKey - The service account key used for authentication.
97029702 * @param silent - Skip writing output to sdout.
97039703 * @returns exit code.
97049704 */
97059705function authenticateGcloudSDK(serviceAccountKey, silent = true) {
97069706 return __awaiter(this, void 0, void 0, function* () {
9707+ // Support legacy actions that pass in SA key
9708+ if (serviceAccountKey) {
9709+ return authGcloudSAKey(serviceAccountKey, silent);
9710+ }
97079711 // Check if GOOGLE_GHA_CREDS_PATH has been set by auth
97089712 if (process.env.GOOGLE_GHA_CREDS_PATH) {
97099713 const credFilePath = process.env.GOOGLE_GHA_CREDS_PATH;
@@ -9714,10 +9718,6 @@ function authenticateGcloudSDK(serviceAccountKey, silent = true) {
97149718 }
97159719 return authGcloudSAKey(credFile, silent);
97169720 }
9717- // Support legacy actions that pass in SA key
9718- if (serviceAccountKey) {
9719- return authGcloudSAKey(serviceAccountKey, silent);
9720- }
97219721 // One of GOOGLE_GHA_CREDS_PATH or SA key is required
97229722 throw new Error('Error authenticating the Cloud SDK. Please use `google-github-actions/auth` to export credentials.');
97239723 });
0 commit comments