Skip to content

nodef/npm-config.action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

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

Options

- 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
      ...


References