Skip to content

node-version-file should support absolute paths #852

Open
@sidvishnoi

Description

@sidvishnoi

Description:

If we pass a absolute path to node-version-file, for example, when using with Composite Actions, the resulting path is resolved incorrectly, due to a path.join() call.

setup-node/src/main.ts

Lines 96 to 100 in 5e21ff4

if (versionFileInput) {
const versionFilePath = path.join(
process.env.GITHUB_WORKSPACE!,
versionFileInput
);

Action version:
v3

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

Repro steps:

  1. In a composite action with .nvmrc, use following as input:
    node-version-file: ${{ github.action_path }}/.nvmrc

Example broken action run: https://github.com/sidvishnoi/mediasession/actions/runs/6158104300/job/16710218833?pr=1

Expected behavior:

If it can check whether provided node-version-file exists as is, or perhaps use path.resolve(), it won't break with absolute paths.

Actual behavior:

Error: The specified node version file at: /home/runner/work/mediasession/mediasession/home/runner/work/_actions/w3c/spec-prod/fix-nvmrc/.nvmrc does not exist
                                                                                      ^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions