Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions eng/common/pipelines/templates/jobs/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ jobs:
displayName: 'Packages to be published'

- ${{ if eq(parameters.Registry, 'https://registry.npmjs.org/') }}:

- task: PowerShell@2
displayName: 'Delete repo .npmrc'
condition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))
inputs:
targetType: inline
script: |
$npmrcPath = "$(System.DefaultWorkingDirectory)/.npmrc"
if (Test-Path $npmrcPath) {
Remove-Item -Path $npmrcPath -Force
Write-Host "Deleted $npmrcPath to use default npmjs registry."
} else {
Write-Host "No repo .npmrc found at $npmrcPath."
}
pwsh: true
Comment on lines +79 to +86
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove-Item failures can be non-terminating in PowerShell, so this step may still succeed even if .npmrc couldn't be removed (e.g., permission/locked file), potentially leaving npm configured to publish/query against the wrong registry. Consider making deletion a hard failure when the file exists (e.g., -ErrorAction Stop / $ErrorActionPreference='Stop' with a clear error message).

Copilot uses AI. Check for mistakes.

- task: EsrpRelease@9
displayName: 'Publish ${{ parameters.ArtifactName }} via ESRP'
condition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))
Expand Down