diff --git a/package-lock.json b/package-lock.json index fb4a0b6..ba010e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@github/local-action", - "version": "2.6.0", + "version": "2.6.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@github/local-action", - "version": "2.6.0", + "version": "2.6.1", "license": "MIT", "dependencies": { "@actions/artifact": "^2.2.0", diff --git a/package.json b/package.json index ef2c984..5f7325e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@github/local-action", "description": "Local Debugging for GitHub Actions", - "version": "2.6.0", + "version": "2.6.1", "type": "module", "author": "Nick Alteen ", "private": false, diff --git a/src/commands/run.ts b/src/commands/run.ts index aff0056..3094537 100644 --- a/src/commands/run.ts +++ b/src/commands/run.ts @@ -122,6 +122,15 @@ export async function action(): Promise { if (dirs.length === 0) throw new Error('Could not find node_modules directory') + // The entrypoint is OS-specific. On Windows, it has to start with a leading + // slash, then the drive letter, followed by the rest of the path. In both + // cases, the path separators are converted to forward slashes. + /* istanbul ignore next */ + const osEntrypoint = + process.platform !== 'win32' + ? path.resolve(EnvMeta.entrypoint) + : '/' + path.resolve(EnvMeta.entrypoint.replaceAll(path.sep, '/')) + // Stub the `@actions/toolkit` libraries and run the action. Quibble and // local-action require a different approach depending on if the called action // is written in ESM. @@ -167,7 +176,7 @@ export async function action(): Promise { ) // ESM actions need to be imported, not required. - const { run } = await import(path.resolve(EnvMeta.entrypoint)) + const { run } = await import(osEntrypoint) // Check if the required path is a function. if (typeof run !== 'function') @@ -218,7 +227,7 @@ export async function action(): Promise { ) // CJS actions need to be required, not imported. - const { run } = require(path.resolve(EnvMeta.entrypoint)) + const { run } = require(osEntrypoint) // Check if the required path is a function. if (typeof run !== 'function')