diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 74ffff232..4c71f8470 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -122611,8 +122611,18 @@ function getCredentials(logger, registrySecrets, registriesCredentials, language `A ${e.type} private registry is configured for ${e.host || e.url} using a GitHub Personal Access Token (PAT), but no username was provided. This may not work correctly. When configuring a private registry using a PAT, select "Username and password" and enter the username of the user who generated the PAT.` ); } + const baseCredential = { type: e.type }; + if (isDefined2(e["replaces-base"])) { + if (typeof e["replaces-base"] === "boolean") { + baseCredential["replaces-base"] = e["replaces-base"]; + } else { + throw new ConfigurationError( + "Invalid credentials - 'replaces-base' must be a boolean" + ); + } + } out.push({ - type: e.type, + ...baseCredential, ...authConfig, ...address }); @@ -123158,7 +123168,8 @@ async function startProxy(binPath, config, logFilePath, logger) { core13.setOutput("proxy_ca_certificate", config.ca.cert); const registry_urls = config.all_credentials.filter((credential) => credential.url !== void 0).map((credential) => ({ type: credential.type, - url: credential.url + url: credential.url, + "replaces-base": credential["replaces-base"] })); core13.setOutput("proxy_urls", JSON.stringify(registry_urls)); return { host, port, cert: config.ca.cert, registries: registry_urls }; diff --git a/src/start-proxy-action.ts b/src/start-proxy-action.ts index a288acc5c..091866377 100644 --- a/src/start-proxy-action.ts +++ b/src/start-proxy-action.ts @@ -198,6 +198,7 @@ async function startProxy( .map((credential) => ({ type: credential.type, url: credential.url, + "replaces-base": credential["replaces-base"], })); core.setOutput("proxy_urls", JSON.stringify(registry_urls)); diff --git a/src/start-proxy.ts b/src/start-proxy.ts index 94ae303e6..868722e15 100644 --- a/src/start-proxy.ts +++ b/src/start-proxy.ts @@ -347,8 +347,21 @@ export function getCredentials( ); } + // Construct the base credential object. + const baseCredential: Omit = { type: e.type }; + + if (isDefined(e["replaces-base"])) { + if (typeof e["replaces-base"] === "boolean") { + baseCredential["replaces-base"] = e["replaces-base"]; + } else { + throw new ConfigurationError( + "Invalid credentials - 'replaces-base' must be a boolean", + ); + } + } + out.push({ - type: e.type, + ...baseCredential, ...authConfig, ...address, }); diff --git a/src/start-proxy/types.ts b/src/start-proxy/types.ts index 98c23662a..8e25b78af 100644 --- a/src/start-proxy/types.ts +++ b/src/start-proxy/types.ts @@ -246,6 +246,8 @@ export function credentialToStr(credential: Credential): string { export type Registry = { /** The type of the package registry. */ type: string; + /** Whether the registry replaces the base registry for the ecosystem. */ + "replaces-base"?: boolean; } & Address; // If a registry has an `url`, then that takes precedence over the `host` which may or may