-
Notifications
You must be signed in to change notification settings - Fork 664
DYN-9590 Update setnpmreg script #16523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ function createNpmrcFile { | |
[Parameter(Mandatory = $true)][string]$registry | ||
) | ||
Write-Host "Creating .npmrc file with registry=$registry" -ForegroundColor Blue | ||
New-Item -Path . -Name ".npmrc" -ItemType "file" -Value "registry=$registry" -Force | ||
New-Item -Path . -Name .npmrc -ItemType File -Value "registry=$registry`n" -Force | ||
} | ||
|
||
try { | ||
|
@@ -19,6 +19,7 @@ try { | |
if ($response.StatusCode -eq 200) { | ||
Write-Host "adsk npm registry is reachable" -ForegroundColor Green | ||
createNpmrcFile -registry $adskNpmRegistry | ||
Write-Output "//npm.autodesk.com/artifactory/api/npm/:_authToken=\`${NPM_TOKEN}" | Out-File -Append -FilePath .npmrc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious where is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is set in the CI Library: https://git.autodesk.com/Pipeline-Community/CILibrary/pull/138 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A testing window has been scheduled for October 23 - 24 @avidit |
||
} | ||
else { | ||
Write-Host "adsk npm registry is not reachable" -ForegroundColor Red | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The authentication token is being written to the .npmrc file without validation that the NPM_TOKEN environment variable exists. This could result in a malformed .npmrc file with 'undefined' or empty token values. Consider adding a check to ensure NPM_TOKEN is set before writing the auth configuration.
Copilot uses AI. Check for mistakes.