3
0
Fork 0
mirror of https://gitea.com/docker/login-action.git synced 2024-11-22 09:29:36 +01:00

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 <frank@vi-di.fr>
Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
Frank Villaro-Dixon 2024-04-30 21:52:07 +02:00 committed by Frank Villaro-Dixon
parent 70fccc794a
commit bfd28af29d
3 changed files with 9 additions and 3 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -21,9 +21,15 @@ export async function logout(registry: string): Promise<void> {
}
export async function loginStandard(registry: string, username: string, password: string): Promise<void> {
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<string> = ['login', '--password-stdin'];
loginArgs.push('--username', username);