Skip to content

Feature request: Support .node-version to specify the version #206

Closed
@karszawa

Description

@karszawa

I'm using nodenv to handle a lot of versions of node binaries on my computer. It provides a .node-version file to change node version based on the current directory. So, I specify the local node version by .node-version as well as setup-node input in GitHub Actions.

In this case, I want to make a .node-version file the only place where the node version is notated. To achieve this, I sometimes read .node-version and provide the result to setup-node like this:

	steps:
	  - uses: actions/checkout@v1

      - name: Read .node-version
        run: echo ::set-output name=NODE_VERSION::$(cat .node-version | cut -c 2-)
        id: nvm

      - name: Setup Node.js
        uses: actions/setup-node@v2
        with:
          node-version: ${{ steps.nvm.outputs.NODE_VERSION }}

This is acceptable, but I think it is a better option for setup-node to have node-version-file as another way to specify the node version like this:

	steps:
	  - uses: actions/checkout@v1

      - name: Setup Node.js
        uses: actions/setup-node@v2-beta
        with:
          node-version-path: '.node-version' # it should be configurable for something like monorepo project which does not have .node-version on the root

I'm willing to implement this feature if the team accepts the idea. Thanks for reading my proposal 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions