Summary
The module entrypoint guard import.meta.url === \file://${process.argv[1]}`is not portable on Windows, whereprocess.argv[1]uses backslash/drive-letter paths that won't match thefile:///... URL form. This only affects local dev/testing (node src/index.js), not Actions runtime (where nccbundles todist/index.js`).
Current
if (import.meta.url === `file://${process.argv[1]}`) {
run();
}
Suggested fix
Use path.resolve on both sides to normalize across platforms:
import { fileURLToPath } from 'url';
import * as path from 'path';
const isMainModule = process.argv[1] &&
path.resolve(fileURLToPath(import.meta.url)) === path.resolve(process.argv[1]);
if (isMainModule) {
run();
}
Impact
- Low — only affects local dev/testing, not GitHub Actions runtime
- Since this is a template, the fix would flow to all derived actions
- Surfaced by Copilot Code Review on a downstream action
Summary
The module entrypoint guard
import.meta.url === \file://${process.argv[1]}`is not portable on Windows, whereprocess.argv[1]uses backslash/drive-letter paths that won't match thefile:///...URL form. This only affects local dev/testing (node src/index.js), not Actions runtime (wherenccbundles todist/index.js`).Current
Suggested fix
Use
path.resolveon both sides to normalize across platforms:Impact