You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
node-version-file should support absolute paths #852
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.
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
^^^
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? 🙌
Apologies for the pings, but it looks like Dmitry hasn't been active on this project in a long time, and this issue may have slipped through the cracks. It would be awesome if someone could take a look at this and any other issues that may have been buried.
Hi @sidvishnoi, Thank you for your suggestion to support absolute paths in the node-version-file. Although we do not have any plans to add this feature at this time, we will consider it as a feature request for the future.
In the meantime, please use the following workarounds:
Use a script to determine the relative path of the action directory and pass it to the node-version-file input:
This script calculates the relative path from the GitHub workspace to the action directory and sets it as the node-version-file, ensuring the path is resolved correctly within the repository context.
2. Set the node version directly in the action, bypassing the need for a version file.
I hope this clarifies the issue and provides a suitable workaround. If you have any further questions, please feel free to ask.
Hi @sidvishnoi, Here is an additional workaround you can use: Use symbolic links: Create a symbolic link:ln -s ${{ github.action_path }}/.nvmrc
Add the symbolic link creation step in your composite action before setting up Node.js. Here’s how you can update your composite action:
- name: Create symbolic link for .nvmrc
run: ln -s ${{ github.action_path }}/.nvmrc
shell: bash
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: ./.nvmrc
This script will create a symbolic link from the root of your repository to the .nvmrc file in your action directory before setting up Node.js.
Let us know if this helps or if you have any further questions!
@gowridurgad There's no point in asking me for updates, as you've said "we will consider it as a feature request for the future." Asking over and over will not get a different answer from me, given it was me who suggested the workarounds you're sharing in one way or other.
I hope you're reading answers and not just asking questions. In this AI age, doesn't feel very human.
Hi @sidvishnoi, Thank you for your feedback. As mentioned previously, we have noted this as a feature request for future consideration. We have sent a reminder to check if the second workaround worked for you. Apologies if it feels repetitive, but our intention is to ensure clarity and keep the discussion transparent. We truly appreciate your patience and continued engagement.
It would solve the issue to add a new context entry similar to github.action_path. Perhaps it would be called github.relative_action_path and would hold the relative path to the action's base folder from the working folder.
The action now uses path.resolve instead of path.join, so an absolute node-version-file input is used as-is. Relative paths continue to resolve against GITHUB_WORKSPACE as before.
Activity
dmitry-shibanov commentedon Sep 12, 2023
Hello @sidvishnoi. Thank you for your report. We'll take a look on it.
evandam commentedon Dec 7, 2023
Hi folks, I'm running into this issue as well, trying to use
${{ github.action_path }}/.tool-versionsbut 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 commentedon Dec 7, 2023
Can confirm would be nice if it could be looked into. @w3c has a workaround here but less than ideal 🙏
marknuzz commentedon Sep 22, 2024
@actions/setup-actions-team @HarithaVattikuti
Apologies for the pings, but it looks like Dmitry hasn't been active on this project in a long time, and this issue may have slipped through the cracks. It would be awesome if someone could take a look at this and any other issues that may have been buried.
v-gowridurgad commentedon Nov 22, 2024
Hi @sidvishnoi, Thank you for your suggestion to support absolute paths in the node-version-file. Although we do not have any plans to add this feature at this time, we will consider it as a feature request for the future.
In the meantime, please use the following workarounds:
This script calculates the relative path from the GitHub workspace to the action directory and sets it as the node-version-file, ensuring the path is resolved correctly within the repository context.
2. Set the node version directly in the action, bypassing the need for a version file.
I hope this clarifies the issue and provides a suitable workaround. If you have any further questions, please feel free to ask.
v-gowridurgad commentedon Dec 3, 2024
Hi @sidvishnoi, Just a gentle reminder regarding this issue, If you have any updates or need further assistance, Please let us know.
sidvishnoi commentedon Dec 3, 2024
@gowridurgad the workaround you shared above is what I created for W3C 😉
Further assistance would be not requiring this workaround.
v-gowridurgad commentedon Dec 9, 2024
Hi @sidvishnoi, Here is an additional workaround you can use:
Use symbolic links:
Create a symbolic link:
ln -s ${{ github.action_path }}/.nvmrcAdd the symbolic link creation step in your composite action before setting up Node.js. Here’s how you can update your composite action:
This script will create a symbolic link from the root of your repository to the .nvmrc file in your action directory before setting up Node.js.
Let us know if this helps or if you have any further questions!
v-gowridurgad commentedon Dec 16, 2024
Hi @sidvishnoi, Just a gentle reminder regarding this issue, If you have any updates or need further assistance, Please let us know.
sidvishnoi commentedon Dec 16, 2024
@gowridurgad There's no point in asking me for updates, as you've said "we will consider it as a feature request for the future." Asking over and over will not get a different answer from me, given it was me who suggested the workarounds you're sharing in one way or other.
I hope you're reading answers and not just asking questions. In this AI age, doesn't feel very human.
v-gowridurgad commentedon Dec 17, 2024
Hi @sidvishnoi, Thank you for your feedback. As mentioned previously, we have noted this as a feature request for future consideration. We have sent a reminder to check if the second workaround worked for you. Apologies if it feels repetitive, but our intention is to ensure clarity and keep the discussion transparent. We truly appreciate your patience and continued engagement.
leemeador commentedon Jan 23, 2025
It would solve the issue to add a new context entry similar to github.action_path. Perhaps it would be called github.relative_action_path and would hold the relative path to the action's base folder from the working folder.
v-mahabaleshwars commentedon Sep 23, 2026
Hi @sidvishnoi,
Fixed by #1633, now merged.
The action now uses
path.resolveinstead ofpath.join, so an absolute node-version-file input is used as-is. Relative paths continue to resolve againstGITHUB_WORKSPACEas before.You can test with
actions/setup-node@main.Thanks for reporting this — closing as resolved.