Skip to content

Commit 8f13ccd

Browse files
authored
Set path for CJS actions on Windows (#172)
When running `@github/local-action` on CommonJS actions on Windows, the entrypoint should not include a leading slash. ESM actions however, appear to require this.
2 parents 8d2a995 + a5f34f1 commit 8f13ccd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/commands/run.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,11 @@ export async function action(): Promise<void> {
284284
const osEntrypoint =
285285
process.platform !== 'win32'
286286
? path.resolve(EnvMeta.entrypoint)
287-
: '/' + path.resolve(EnvMeta.entrypoint.replaceAll(path.sep, '/'))
287+
: // On Windows, the entrypoint requires a leading slash if the action is
288+
// ESM. Otherwise, it can be omitted.
289+
actionType === 'esm'
290+
? '/' + path.resolve(EnvMeta.entrypoint)
291+
: path.resolve(EnvMeta.entrypoint.replaceAll(path.sep, '/'))
288292

289293
// Stub the `@actions/toolkit` libraries and run the action. Quibble and
290294
// local-action require a different approach depending on if the called action

0 commit comments

Comments
 (0)