Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-version-file should support absolute paths #852

Open
2 of 5 tasks
sidvishnoi opened this issue Sep 12, 2023 · 3 comments
Open
2 of 5 tasks

node-version-file should support absolute paths #852

sidvishnoi opened this issue Sep 12, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@sidvishnoi
Copy link

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
                                                                                      ^^^
@dmitry-shibanov
Copy link
Contributor

Hello @sidvishnoi. Thank you for your report. We'll take a look on it.

@evandam
Copy link

evandam commented Dec 7, 2023

Hi folks, I'm running into this issue as well, trying to use ${{ github.action_path }}/.tool-versions but it tries to append the path to the current directory.

It's a pretty frustrating and unexpected behavior as far as I can tell. Any hope to see a fix to this soon? 🙌

@scalp42
Copy link

scalp42 commented Dec 7, 2023

Can confirm would be nice if it could be looked into. @w3c has a workaround here but less than ideal 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants