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
4 changes: 2 additions & 2 deletions scripts/finalize-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ main() {

local registry="${INPUT_NPM_REGISTRY:-https://registry.npmjs.org}"
local registry_host
registry_host=$(echo "$registry" | sed 's|https:||')
registry_host=$(echo "$registry" | sed 's|https:||' | sed 's|/$||')
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

registry_host normalization only strips the https: scheme. If a user supplies an http:// registry URL (or another scheme), the generated auth line in .npmrc will be malformed. Consider stripping both http: and https: (e.g., by matching ^https?://), or using a more robust URL normalization approach so npm-registry accepts any valid http(s) URL.

Suggested change
registry_host=$(echo "$registry" | sed 's|https:||' | sed 's|/$||')
registry_host=$(echo "$registry" | sed -E 's|^https?://|//|' | sed 's|/$||')

Copilot uses AI. Check for mistakes.

echo "${registry_host}:_authToken=${INPUT_NPM_TOKEN}" > .npmrc
echo "${registry_host}/:_authToken=${INPUT_NPM_TOKEN}" > .npmrc
echo "registry=${registry}" >> .npmrc

npm publish
Comment on lines +79 to 82
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

This writes the auth token to a .npmrc in the workspace. With set -e, if npm publish fails the script will exit before cleanup, potentially leaving the token on disk for later steps/artifacts. Consider writing to a temp userconfig (e.g., via NPM_CONFIG_USERCONFIG) and/or installing a trap to remove the file on EXIT/ERR so the token is always cleaned up.

Copilot uses AI. Check for mistakes.
Expand Down
Loading