@@ -122,6 +122,15 @@ export async function action(): Promise<void> {
122
122
if ( dirs . length === 0 )
123
123
throw new Error ( 'Could not find node_modules directory' )
124
124
125
+ // The entrypoint is OS-specific. On Windows, it has to start with a leading
126
+ // slash, then the drive letter, followed by the rest of the path. In both
127
+ // cases, the path separators are converted to forward slashes.
128
+ /* istanbul ignore next */
129
+ const osEntrypoint =
130
+ process . platform !== 'win32'
131
+ ? path . resolve ( EnvMeta . entrypoint )
132
+ : '/' + path . resolve ( EnvMeta . entrypoint . replaceAll ( path . sep , '/' ) )
133
+
125
134
// Stub the `@actions/toolkit` libraries and run the action. Quibble and
126
135
// local-action require a different approach depending on if the called action
127
136
// is written in ESM.
@@ -167,7 +176,7 @@ export async function action(): Promise<void> {
167
176
)
168
177
169
178
// ESM actions need to be imported, not required.
170
- const { run } = await import ( path . resolve ( EnvMeta . entrypoint ) )
179
+ const { run } = await import ( osEntrypoint )
171
180
172
181
// Check if the required path is a function.
173
182
if ( typeof run !== 'function' )
@@ -218,7 +227,7 @@ export async function action(): Promise<void> {
218
227
)
219
228
220
229
// CJS actions need to be required, not imported.
221
- const { run } = require ( path . resolve ( EnvMeta . entrypoint ) )
230
+ const { run } = require ( osEntrypoint )
222
231
223
232
// Check if the required path is a function.
224
233
if ( typeof run !== 'function' )
0 commit comments