Skip to content

Commit

Permalink
Fix edge case when gcloud is not installed at all
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo committed Dec 21, 2023
1 parent fd83cd9 commit 22fe1ab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,19 @@ 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 = false;
try {
authed = await isAuthenticated();
} catch (err) {}

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.
Expand Down

0 comments on commit 22fe1ab

Please sign in to comment.