A GitHub Action for configuring npm.
# Configure credentials for npm and GitHub Packages.
- uses: nodef/npm-config.action@v1.0.0
with:
credentials: |-
registry.npmjs.org=${{secrets.NPM_TOKEN}}
npm.pkg.github.com=${{secrets.GITHUB_TOKEN}}
# Automatically configure credentials using environment variables.
# Needs $NPM_TOKEN and $GH_TOKEN/$GITHUB_TOKEN to be set.
- uses: nodef/npm-config.action@v1.0.0
with:
credentials: auto
# Automatically configure credentials, add a scope for GitHub Packages,
# and allow packages to be publicly visible.
- uses: nodef/npm-config.action@v1.0.0
with:
entries: |-
@myorg:registry=https://npm.pkg.github.com
access=public- uses: nodef/npm-config.action@v1.0.0
with:
path: $HOME/.npmrc # Path to the .npmrc file
reset: false # Reset the .npmrc file
credentials: |- # Credentials to configure [auto]
myregistry1=authtoken1
myregistry2=authtoken2
...
entries: |- # Entries to add
key1=value1
key2=value2
...- healthplace/npmrc-registry-login-action : Matthew Inamdar
- google-github-actions/get-secretmanager-secrets
- config: More than you probably want to know about npm configuration - npm Docs
- npmrc: The npm config files - npm Docs
- scope: Scoped packages - npm Docs
- Creating a JavaScript Action - GitHub Docs
- Metadata syntax for GitHub Actions - GitHub Docs
- How to use array input for a custom GitHub Actions
- Give credentials to npm login command line
- How to restore/reset npm configuration to default values?
- Why does the npm userconfig not get picked up?