fix: add .zip extension if it's not present

Workaround for https://github.com/actions/toolkit/issues/1179

Fixes https://github.com/oven-sh/setup-bun/issues/79
This commit is contained in:
Jozef Steinhübl 2024-05-08 10:18:01 +02:00
parent 77ae1717ed
commit f885433d15
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F
2 changed files with 12 additions and 3 deletions

View file

@ -13,7 +13,7 @@ import { downloadTool, extractZip } from "@actions/tool-cache";
import { getExecOutput } from "@actions/exec";
import { writeBunfig } from "./bunfig";
import { saveState } from "@actions/core";
import { retry } from "./utils";
import { addExtension, retry } from "./utils";
export type Input = {
customUrl?: string;
@ -119,7 +119,7 @@ async function downloadBun(
url: string,
bunPath: string
): Promise<string | undefined> {
const zipPath = await downloadTool(url);
const zipPath = addExtension(await downloadTool(url), ".zip");
const extractedZipPath = await extractZip(zipPath);
const extractedBunPath = await extractBun(extractedZipPath);
try {