fix(ci): downgrade npm auth token list check to warning#2547
Merged
Conversation
Copilot
AI
changed the title
[WIP]
Fix verifyNpmAuth E403 error by making token list check non-fatal
Jul 7, 2025
verifyNpmAuth in .ado/scripts/prepublish-check.mjs fails
Saadnajmi
reviewed
Jul 7, 2025
Saadnajmi
reviewed
Jul 7, 2025
Collaborator
|
I looked into it, and indeed our NPM access token / account doesn't want to be listed (but still works). So the change is sound, but I need to refactor a bit, so I'll probably fork this. |
20a6303 to
e090cf7
Compare
This was referenced Jul 9, 2025
dannyvv
approved these changes
Jul 9, 2025
rurikoaraki
approved these changes
Jul 9, 2025
Saadnajmi
added a commit
that referenced
this pull request
Jul 9, 2025
Saadnajmi
added a commit
that referenced
this pull request
Jul 9, 2025
Saadnajmi
added a commit
that referenced
this pull request
Jul 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
verifyNpmAuthfunction in.ado/scripts/prepublish-check.mjswas failing in CI with:This occurred because the function performs two npm checks:
npm whoami --registry <registry>- verifies user authentication ✅npm token list --registry <registry>- attempts to list user tokens ❌While the first check succeeds (confirming the user is authenticated), the second check fails with E403 because some npm tokens don't have permission to list tokens, even though they can publish packages successfully.
Solution
Made a minimal change to treat E403 errors from
npm token listas non-fatal warnings:Benefits
npm whoamistill validates authentication properlyTesting
This surgical fix resolves the specific CI authentication issue while preserving all existing safeguards and functionality.
Fixes #2546.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.