mirror of
https://github.com/google-github-actions/setup-gcloud.git
synced 2026-08-21 01:29:26 +00:00
Fix edge case when gcloud is not installed at all (#672)
This commit is contained in:
parent
fd83cd9564
commit
191b97bd2f
2 changed files with 16 additions and 6 deletions
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
20
src/main.ts
20
src/main.ts
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue