Skip to content

Commit 191b97b

Browse files
authored
Fix edge case when gcloud is not installed at all (#672)
1 parent fd83cd9 commit 191b97b

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,21 @@ export async function run(): Promise<void> {
103103
if (credFile) {
104104
await authenticateGcloudSDK(credFile);
105105
core.info('Successfully authenticated');
106-
} else if (!(await isAuthenticated())) {
107-
core.warning(
108-
`The gcloud CLI is not authenticated. Authenticate by adding the ` +
109-
`"google-github-actions/auth" step prior this one.`,
110-
);
106+
} else {
107+
let authed;
108+
try {
109+
authed = await isAuthenticated();
110+
} catch {
111+
authed = false;
112+
}
113+
114+
if (!authed) {
115+
core.warning(
116+
`The gcloud CLI is not authenticated (or it is not installed). ` +
117+
`Authenticate by adding the "google-github-actions/auth" step ` +
118+
`prior this one.`,
119+
);
120+
}
111121
}
112122

113123
// Set the project ID, if given.

0 commit comments

Comments
 (0)