Refactor version resolving (#852)

This commit is contained in:
Kevin Stillhammer
2026-04-11 11:38:41 +02:00
committed by GitHub
parent cb84d12dc6
commit cdfb2ee6dd
16 changed files with 3233 additions and 2435 deletions

View File

@@ -111,6 +111,9 @@ export async function getLatestVersion(
export async function getAllVersions(
manifestUrl: string = VERSIONS_MANIFEST_URL,
): Promise<string[]> {
core.info(
`Getting available versions from ${manifestSource(manifestUrl)} ...`,
);
const versions = await fetchManifest(manifestUrl);
return versions.map((versionData) => versionData.version);
}
@@ -165,6 +168,14 @@ export function clearManifestCache(manifestUrl?: string): void {
cachedManifestData.delete(manifestUrl);
}
function manifestSource(manifestUrl: string): string {
if (manifestUrl === VERSIONS_MANIFEST_URL) {
return VERSIONS_MANIFEST_URL;
}
return `manifest-file ${manifestUrl}`;
}
function isManifestVersion(value: unknown): value is ManifestVersion {
if (!isRecord(value)) {
return false;