Actually fix double zip issue

This commit is contained in:
Ashcon Partovi 2023-02-22 18:19:00 -08:00
parent a730821cf4
commit 15050a7632
2 changed files with 23 additions and 18 deletions

18
dist/setup.js vendored
View file

@ -74,14 +74,18 @@ function getDownloadUrl(options) {
}
async function extractBun(path) {
for (const entry of await readdir(path, { withFileTypes: true })) {
const entryPath = join(path, entry.name);
action.debug(`Looking: ${entryPath}`);
if (entry.name === "bun" && entry.isFile()) {
action.debug(`Found: ${entryPath}`);
return entryPath;
const { name } = entry;
const entryPath = join(path, name);
if (entry.isFile()) {
if (name === "bun") {
return entryPath;
}
if (/^bun.*\.zip/.test(name)) {
const extractedPath = await extractZip(entryPath);
return extractBun(extractedPath);
}
}
if (entry.name.startsWith("bun") && entry.isDirectory()) {
action.debug(`Continue looking: ${entryPath}`);
if (/^bun/.test(name) && entry.isDirectory()) {
return extractBun(entryPath);
}
}