From b5e3caf47aa09d586b556ecb3e36cfcade89cf8f Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Mon, 11 Sep 2023 09:11:29 -0700 Subject: [PATCH] Add symlink for bunx --- src/setup.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/setup.ts b/src/setup.ts index 435ed9e..087f8f9 100644 --- a/src/setup.ts +++ b/src/setup.ts @@ -1,6 +1,6 @@ import { homedir } from "node:os"; import { join } from "node:path"; -import { readdir } from "node:fs/promises"; +import { readdir, symlink } from "node:fs/promises"; import * as action from "@actions/core"; import { downloadTool, extractZip } from "@actions/tool-cache"; import * as cache from "@actions/cache"; @@ -51,6 +51,13 @@ export default async (options?: { "Downloaded a new version of Bun, but failed to check its version? Try again in debug mode." ); } + try { + await symlink(path, join(dir, "bunx")); + } catch (error) { + if (error.code !== "EEXIST") { + throw error; + } + } if (cacheEnabled) { try { await saveCache([path], cacheKey);