refactor: move logic to getEffectiveArch func

This commit is contained in:
Jozef Steinhübl 2025-07-10 20:23:56 +02:00
parent c2c1757aa0
commit bcfe2a9ff6
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F

View file

@ -155,6 +155,15 @@ function isCacheEnabled(options: Input): boolean {
return isFeatureAvailable(); return isFeatureAvailable();
} }
function getEffectiveArch(os: string, arch: string): string {
// Temporary workaround for absence of arm64 builds on Windows (#130)
if (os === "win32" && arch === "arm64") {
return "x64";
}
return arch;
}
function getDownloadUrl(options: Input): string { function getDownloadUrl(options: Input): string {
const { customUrl } = options; const { customUrl } = options;
if (customUrl) { if (customUrl) {
@ -164,10 +173,8 @@ function getDownloadUrl(options: Input): string {
const eversion = encodeURIComponent(version ?? "latest"); const eversion = encodeURIComponent(version ?? "latest");
const eos = encodeURIComponent(os ?? process.platform); const eos = encodeURIComponent(os ?? process.platform);
const earch = encodeURIComponent( const earch = encodeURIComponent(
(os ?? process.platform) === "win32" && (arch ?? process.arch) === "arm64" getEffectiveArch(os ?? process.platform, arch ?? process.arch),
? "x64" );
: (arch ?? process.arch),
); // Temporary workaround for absence of arm64 builds on Windows (#130)
const eavx2 = encodeURIComponent(avx2 ?? true); const eavx2 = encodeURIComponent(avx2 ?? true);
const eprofile = encodeURIComponent(profile ?? false); const eprofile = encodeURIComponent(profile ?? false);
const { href } = new URL( const { href } = new URL(