From f09eb1edd0a8b355ceeffa8389f83b91db37b51a Mon Sep 17 00:00:00 2001 From: Florian Barbare Date: Mon, 9 Dec 2024 17:46:15 +0000 Subject: [PATCH] fix: make bun resolve to given file path when an absolute path is given (#114) * Make bun resolve to single file path when an absolute path is given * Update test not to use the workspace folder --- .github/workflows/test.yml | 4 ++++ src/utils.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb9ac3a..227d551 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -85,6 +85,10 @@ jobs: file: package.json run: | echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > package.json + - name: /foo/package.json (bun@1.1.0) + file: /foo/package.json + run: | + echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > /foo/package.json - name: package.json (yarn@bun@1.1.0) file: package.json run: | diff --git a/src/utils.ts b/src/utils.ts index a8b69c0..7e0ca63 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,7 +1,7 @@ import { debug, warning } from "@actions/core"; import { info } from "node:console"; import { existsSync, readFileSync, renameSync } from "node:fs"; -import { join, basename } from "node:path"; +import { resolve, basename } from "node:path"; export function retry( fn: () => Promise, @@ -48,7 +48,7 @@ export function readVersionFromFile(file: string): string | undefined { debug(`Reading version from ${file}`); - const path = join(cwd, file); + const path = resolve(cwd, file); const base = basename(file); if (!existsSync(path)) {