Skip to content

Import-safe entrypoints when run from non-canonical path: doesn't run #1264

Description

@otaconix

Description:

**NB:**This issue may only occur when running this action outside of GitHub actions infrastructure.

When running this action with a non-canonical path, such as appears to be happening on my Forgejo setup (see details below), the "import-safe" entrypoints fail to run, printing instead:

the script is loaded as a module, so skipping the execution

The cause seems to be:

  1. my runner loads actions into /var/run
  2. /var/run is a symlink to /run
  3. NodeJS appears to put a canonical path (as in: all symlinks get resolved) into import.meta.url
  4. process.argv[1] === fileURLToPath(import.meta.url) thus evaluates to false

It'd be fantastic if there were a way to make setup-java work under these circumstances.

Details

Forgejo version: 16.0.3
Forgejo runner version: 13
Image used to run action: ghcr.io/catthehacker/ubuntu:runner-24.04

Task version:
v6

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:
I do not have a simple way to reproduce this, but here's a Dockerfile to demonstrate that import.meta.url contains a canonicalized path:

FROM alpine

RUN apk --no-cache add nodejs
RUN mkdir dir
RUN ln -s dir symlink
RUN echo 'console.log(`process.argv[1]: ${process.argv[1]}`); console.log(`import.meta.url: ${import.meta.url}`)' > dir/test.js

CMD node dir/test.js; node symlink/test.js

Expected behavior:
I expect the action to run normally.

Actual behavior:
The action says it won't run because the "script was loaded as a module"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions