From 1e928945a0398e2467ff5cc9880b69f94f22a61d Mon Sep 17 00:00:00 2001 From: Frank Villaro-Dixon Date: Tue, 30 Apr 2024 21:52:07 +0200 Subject: [PATCH] docker auth: improve missing user/pwd Specify the "missing username and password" error message. This makes debugging the action easier when for example mistyping the username or the password. Signed-off-by: Frank Villaro-Dixon Signed-off-by: Frank Villaro-Dixon --- src/docker.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/docker.ts b/src/docker.ts index fd3194a9..08b0a434 100644 --- a/src/docker.ts +++ b/src/docker.ts @@ -21,9 +21,16 @@ export async function logout(registry: string): Promise { } export async function loginStandard(registry: string, username: string, password: string): Promise { - if (!username || !password) { + if (!username && !password) { throw new Error('Username and password required'); } + if (!username) { + throw new Error('Username required'); + } + if (!password) { + throw new Error('Password required'); + } + const loginArgs: Array = ['login', '--password-stdin']; loginArgs.push('--username', username);