-
Notifications
You must be signed in to change notification settings - Fork 0
fix: write npmrc for npm pub #17
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
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 |
|---|---|---|
|
|
@@ -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|/$||') | ||
|
|
||
| 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
|
||
|
|
||
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.
registry_hostnormalization only strips thehttps:scheme. If a user supplies anhttp://registry URL (or another scheme), the generated auth line in.npmrcwill be malformed. Consider stripping bothhttp:andhttps:(e.g., by matching^https?://), or using a more robust URL normalization approach sonpm-registryaccepts any valid http(s) URL.