Skip to content

Commit f88d49e

Browse files
committed
Fix warning for PAT-like token with username
1 parent 28f515d commit f88d49e

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

lib/start-proxy-action.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/start-proxy.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -447,15 +447,18 @@ export function getCredentials(
447447
}
448448

449449
// If the password or token looks like a GitHub PAT, warn if no username is configured.
450-
if (
451-
((!hasUsername(authConfig) || !isDefined(authConfig.username)) &&
452-
isUsernamePassword(authConfig) &&
453-
isDefined(authConfig.password) &&
454-
isPAT(authConfig.password)) ||
455-
(isToken(authConfig) &&
456-
isDefined(authConfig.token) &&
457-
isPAT(authConfig.token))
458-
) {
450+
const noUsername =
451+
!hasUsername(authConfig) || !isDefined(authConfig.username);
452+
const passwordIsPAT =
453+
isUsernamePassword(authConfig) &&
454+
isDefined(authConfig.password) &&
455+
isPAT(authConfig.password);
456+
const tokenIsPAT =
457+
isToken(authConfig) &&
458+
isDefined(authConfig.token) &&
459+
isPAT(authConfig.token);
460+
461+
if (noUsername && (passwordIsPAT || tokenIsPAT)) {
459462
logger.warning(
460463
`A ${e.type} private registry is configured for ${e.host || e.url} using a GitHub Personal Access Token (PAT), but no username was provided. ` +
461464
`This may not work correctly. When configuring a private registry using a PAT, select "Username and password" and enter the username of the user ` +

0 commit comments

Comments
 (0)