Fix edge case when gcloud is not installed at all (#672)

This commit is contained in:
Seth Vargo 2023-12-20 22:49:01 -05:00 committed by GitHub
parent fd83cd9564
commit 191b97bd2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -103,11 +103,21 @@ export async function run(): Promise<void> {
if (credFile) {
await authenticateGcloudSDK(credFile);
core.info('Successfully authenticated');
} else if (!(await isAuthenticated())) {
core.warning(
`The gcloud CLI is not authenticated. Authenticate by adding the ` +
`"google-github-actions/auth" step prior this one.`,
);
} else {
let authed;
try {
authed = await isAuthenticated();
} catch {
authed = false;
}
if (!authed) {
core.warning(
`The gcloud CLI is not authenticated (or it is not installed). ` +
`Authenticate by adding the "google-github-actions/auth" step ` +
`prior this one.`,
);
}
}
// Set the project ID, if given.