GithubHelp home page GithubHelp logo

project's .npmrc not respected about action HOT 3 OPEN

changesets avatar changesets commented on September 1, 2024 1
project's .npmrc not respected

from action.

Comments (3)

talves avatar talves commented on September 1, 2024 5

Update Explanation: actions/setup-node creates an auth file when the registry-url exists and uses NODE_AUTH_TOKEN then puts that path in the NPM_CONFIG_USERCONFIG environment variable. I believe this now overrides the use of the .npmrc file and why it's not used.

https://github.com/actions/setup-node/blob/78148dae5052c4942d5b0f92719061df122a3b1c/src/authutil.ts#L41

I wonder if changesets/action should maybe check for NPM_CONFIG_USERCONFIG existing before it writes out the .npmrc file and/or log out an explanation.

Maybe someone can explain if this is true or clear up any misunderstanding.

from action.

talves avatar talves commented on September 1, 2024

I don't think this .npmrc is even being used by changesets.

I found that using action/node-setup and the registry-url you need to set NODE_AUTH_TOKEN

I had to replace my env.NPM_TOKEN with env.NODE_AUTH_TOKEN because I'm using actions/node-setup and changesets is working fine without the NPM_TOKEN.

from action.

nikparo avatar nikparo commented on September 1, 2024

For a CI action to be hard-coded to only check $HOME/.npmrc is pretty bad imo. At least self-hosted runners are often stateful, and potentially concurrent, so adding files to a shared directory should be avoided. Especially since the action doesn't clean up after itself.

As a workaround I opted to change the $HOME variable during the run. Not ideal, but it appears to work just fine. If someone knows how to set $HOME using jobs.steps.env, then that would be even better.

  # changesets/action presumes the .npmrc is in $HOME
  # See:
  # - https://github.com/changesets/action/issues/58
  # - https://github.com/changesets/action/blob/2bb9bcbd6bf4996a55ce459a630a0aa699457f59/src/index.ts#L58
  - name: Set HOME
    run: echo "HOME=$(pwd)" >> $GITHUB_ENV

Edit: use jobs.steps.env like this, as shown in #147

env:
    HOME: ${{ github.workspace }}

from action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.