mirror of
https://github.com/google-github-actions/setup-gcloud.git
synced 2026-08-20 10:19:27 +00:00
Only warn when there are no authentications (#671)
This fixes an issue where a warning message would be printed on systems using ADC from the metadata server. Fixes https://github.com/google-github-actions/setup-gcloud/issues/670
This commit is contained in:
parent
f14c440264
commit
fd83cd9564
3 changed files with 6 additions and 3 deletions
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -21,6 +21,7 @@ import {
|
|||
bestVersion,
|
||||
installComponent,
|
||||
installGcloudSDK,
|
||||
isAuthenticated,
|
||||
setProject,
|
||||
} from '@google-github-actions/setup-cloud-sdk';
|
||||
import {
|
||||
|
|
@ -102,9 +103,10 @@ export async function run(): Promise<void> {
|
|||
if (credFile) {
|
||||
await authenticateGcloudSDK(credFile);
|
||||
core.info('Successfully authenticated');
|
||||
} else {
|
||||
} else if (!(await isAuthenticated())) {
|
||||
core.warning(
|
||||
'No authentication found for gcloud, authenticate with `google-github-actions/auth`.',
|
||||
`The gcloud CLI is not authenticated. Authenticate by adding the ` +
|
||||
`"google-github-actions/auth" step prior this one.`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ const defaultMocks = (
|
|||
}),
|
||||
|
||||
authenticateGcloudSDK: m.method(setupGcloud, 'authenticateGcloudSDK', () => {}),
|
||||
isAuthenticated: m.method(setupGcloud, 'isAuthenticated', () => {}),
|
||||
isInstalled: m.method(setupGcloud, 'isInstalled', () => {
|
||||
return true;
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue