From a02a550bdd3185dba2ebb6aa98d77047ce54ad21 Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Wed, 18 Jun 2025 23:09:13 +0200 Subject: [PATCH] Look for version-manifest.json relative to action path (#456) Fixes: #455 --- dist/setup/index.js | 4 +++- dist/update-known-versions/index.js | 12 +++++++++++- src/download/version-manifest.ts | 5 ++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index fda244c..eed451c 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -124868,6 +124868,8 @@ const node_fs_1 = __nccwpck_require__(73024); const core = __importStar(__nccwpck_require__(37484)); const semver = __importStar(__nccwpck_require__(39318)); const fetch_1 = __nccwpck_require__(3385); +const node_path_1 = __nccwpck_require__(76760); +const localManifestFile = (0, node_path_1.join)(__dirname, "..", "..", "version-manifest.json"); async function getLatestKnownVersion(manifestUrl) { const manifestEntries = await getManifestEntries(manifestUrl); return manifestEntries.reduce((a, b) => semver.gt(a.version, b.version) ? a : b).version; @@ -124891,7 +124893,7 @@ async function getManifestEntries(manifestUrl) { } else { core.info("manifest-file not provided, reading from local file."); - const fileContent = await node_fs_1.promises.readFile("version-manifest.json"); + const fileContent = await node_fs_1.promises.readFile(localManifestFile); data = fileContent.toString(); } return JSON.parse(data); diff --git a/dist/update-known-versions/index.js b/dist/update-known-versions/index.js index 5e23df4..6ab1701 100644 --- a/dist/update-known-versions/index.js +++ b/dist/update-known-versions/index.js @@ -62432,6 +62432,8 @@ const node_fs_1 = __nccwpck_require__(3024); const core = __importStar(__nccwpck_require__(7484)); const semver = __importStar(__nccwpck_require__(9318)); const fetch_1 = __nccwpck_require__(3385); +const node_path_1 = __nccwpck_require__(6760); +const localManifestFile = (0, node_path_1.join)(__dirname, "..", "..", "version-manifest.json"); async function getLatestKnownVersion(manifestUrl) { const manifestEntries = await getManifestEntries(manifestUrl); return manifestEntries.reduce((a, b) => semver.gt(a.version, b.version) ? a : b).version; @@ -62455,7 +62457,7 @@ async function getManifestEntries(manifestUrl) { } else { core.info("manifest-file not provided, reading from local file."); - const fileContent = await node_fs_1.promises.readFile("version-manifest.json"); + const fileContent = await node_fs_1.promises.readFile(localManifestFile); data = fileContent.toString(); } return JSON.parse(data); @@ -62840,6 +62842,14 @@ module.exports = require("node:net"); /***/ }), +/***/ 6760: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:path"); + +/***/ }), + /***/ 643: /***/ ((module) => { diff --git a/src/download/version-manifest.ts b/src/download/version-manifest.ts index 60c3026..206e1bb 100644 --- a/src/download/version-manifest.ts +++ b/src/download/version-manifest.ts @@ -2,6 +2,9 @@ import { promises as fs } from "node:fs"; import * as core from "@actions/core"; import * as semver from "semver"; import { fetch } from "../utils/fetch"; +import { join } from "node:path"; + +const localManifestFile = join(__dirname, "..", "..", "version-manifest.json"); interface ManifestEntry { version: string; @@ -51,7 +54,7 @@ async function getManifestEntries( data = await response.text(); } else { core.info("manifest-file not provided, reading from local file."); - const fileContent = await fs.readFile("version-manifest.json"); + const fileContent = await fs.readFile(localManifestFile); data = fileContent.toString(); }