Accept replaces-base option

This commit is contained in:
Michael B. Gale
2026-04-25 17:54:46 +01:00
parent 4d2c7c6e10
commit efdcb31f11
4 changed files with 30 additions and 3 deletions
+13 -2
View File
@@ -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 };
+1
View File
@@ -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));
+14 -1
View File
@@ -347,8 +347,21 @@ export function getCredentials(
);
}
// Construct the base credential object.
const baseCredential: Omit<Registry, keyof Address> = { 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,
});
+2
View File
@@ -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