fix: #424 - Publish in custom artifactory#425
fix: #424 - Publish in custom artifactory#425gethari wants to merge 2 commits intochangesets:mainfrom
Conversation
🦋 Changeset detectedLatest commit: c2796d4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@Andarist, could you kindly review this when you have a moment? I’m relying on this change to get my actions working and would prefer to avoid forking the repository for such a small update. Thank you! |
| // check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105 | ||
| return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line); | ||
| }); | ||
| const authLine = extractAuthTokenLine(userNpmrcContent); |
There was a problem hiding this comment.
You have mentioned that the previous version of the code goes in to the else branch and that creates a problem. I don't understand this. Even if it goes there... it will just append a different token to ur .npmrc file and that's about it. Your correct token should still be used when publishing to a custom artifactory
There was a problem hiding this comment.
No @Andarist, by creating this extract function, the code will goes to this block.
if (authLine) {
core.info(
"Found existing auth token for the npm registry in the user .npmrc file"
);
}and we will not create the other .npmrc.
| const line = npmrcContent.split("\n").find((line) => { | ||
| return /^\s*\/\/.*\/:(_auth|_authToken)=/i.test(line); // Match both _auth and _authToken | ||
| }); | ||
| return line ? line.trim() : undefined; |
There was a problem hiding this comment.
| return line ? line.trim() : undefined; | |
| return line?.trim(); |
|
This is very important fix for people that is not using default npm registry. Please help to drive this pull request. |
|
Duplicate w #362 |
|
@Andarist do you want to consider merging this , if I resolve the conflicts ? |
Fixes #424