Skip to content

Commit

Permalink
docker auth: improve missing user/pwd
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Frankkkkk committed May 16, 2024
1 parent 70fccc7 commit bfd28af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bfd28af

Please sign in to comment.