GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support GPR in .npmrc · Issue #178 · changesets/action

Support GPR in .npmrc #178

New issue
Copy link
New issue
Copy link
Closed
Feature
#695
Closed
Support GPR in .npmrc#178
Feature
#695
Copy link

Description

@meleksomai
meleksomai
opened on Apr 30, 2022
Issue body actions

I am trying to publish monorepo packages to a private Github registry using changesets/action.

Whenever I push to main, I get the following error:

npm notice 📦  @inception-health/[email protected]
npm notice === Tarball Contents === 
npm notice 1.3kB dist/index.js  
npm notice 960B  package.json   
npm notice 284B  dist/index.mjs 
npm notice 209B  dist/index.d.ts
npm notice === Tarball Details === 
npm notice name:          @inception-health/utils                 
npm notice version:       0.0.1                                   
npm notice package size:  1.2 kB                                  
npm notice unpacked size: 2.7 kB                                  
npm notice shasum:        12d6dc8e84110XXXXXX
npm notice integrity:     sha512-tGyxr7tYjFXh2[...]XXXXXXXXXX
npm notice total files:   4                                       
npm notice 
npm ERR! code E401
npm ERR! 401 Unauthorized - PUT https://npm.pkg.github.com/@inception-health%2futils - Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.

I have the following configuration:

.npmrc

@inception-health:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN

Note: I also tried to dynamically add the .npmrc during the workflow build

      - name: Creating .npmrc
        run: |
          cat << EOF > "$HOME/.npmrc"
            @inception-health:registry=https://npm.pkg.github.com/
            //npm.pkg.github.com/:_authToken=$GITHUB_TOKEN
          EOF
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Github Workflow

name: Changesets
on:
  push:
    branches:
      - main
env:
  CI: true
  PNPM_CACHE_FOLDER: .pnpm-store
jobs:
  version:
    timeout-minutes: 15
    runs-on: ubuntu-latest
    permissions: write-all
    steps:
      - name: checkout code repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: setup node.js
        uses: actions/setup-node@v2
        with:
          node-version: 14
          registry-url: https://npm.pkg.github.com/
          scope: "@inception-health"
      - name: install pnpm
        run: npm i pnpm@latest -g
      - name: setup pnpm config
        run: pnpm config set store-dir $PNPM_CACHE_FOLDER
      - name: install dependencies
        run: pnpm install
      - name: create and publish versions
        uses: changesets/action@v1
        with:
          version: pnpm ci:version
          commit: "chore: update versions"
          title: "chore: update versions"
          publish: pnpm ci:publish
          setupGitUser: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Note: I also tried to replace the GITHUB_TOKEN with a custom PAT. Same error.

Package.json

For all the packages I wanted to publish, I included the following config

{
   ...
  "publishConfig": {
    "access": "restricted",
    "registry": "https://npm.pkg.github.com/inception-health/"
  }
}

CI Action

This is the pnpm script for ci:publish that are included in the root package.json.

{
 ...
  "scripts": {
    "ci:publish": "pnpm build && pnpm recursive publish",
    "ci:version": "pnpm changeset version"
  },
 ...
}

I don't know what is missing? I appreciate any guidance.

Version

  • pnpm: 7.0.0-rc.9
  • @changesets/cli: "^2.22.0"
Reacted by Justin Leatherwood, Maikel van Dort, Connor Bär, Toru Eguchi, Leonardo Juriolli, Jozef Harag and Laura Murphy-Clarkin

Activity

  1. LiKang6688 commented on Sep 30, 2022

    @LiKang6688
    LiKang6688
    on Sep 30, 2022
    More actions

    Looks like changesets’s github action only supports npm Registry not Github Packages
    https://github.com/changesets/action/blob/main/src/index.ts#L64

    Reacted by Justin Leatherwood, Leonardo Juriolli, seunghee and Laura Murphy-Clarkin
  2. jplwood commented on Jan 6, 2023

    @jplwood
    jplwood
    on Jan 6, 2023
    More actions

    If there is an alternate, valid registry defined in an .npmrc file, shouldn't that be supported? We also ran into this when trying to publish a package to the github package registry

    Reacted by TM™️, Leonardo Juriolli, Sven Lombaert and Laura Murphy-Clarkin
  3. MartinDawson commented on Dec 3, 2023

    @MartinDawson
    MartinDawson
    on Dec 3, 2023
    More actions

    @jplwood You can pass NPM_TOKEN to validate.

  4. bluwy commented on May 15, 2026

    @bluwy
    bluwy
    on May 15, 2026
    Member
    More actions

    I believe NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} should workaround the problem so it doesn't rely on npmrc parsing.

  5. bluwy
    added the
    Feature
    issue type on May 15, 2026
  6. bluwy
    changed the title [-]pnpm github 401 Unauthorized[/-] [+]Support GPR in .npmrc[/+] on May 15, 2026
  7. bluwy
    closed this as completedin #695on Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.