Skip to content

Commit

Permalink
fix: Make sure registry url ends with a /
Browse files Browse the repository at this point in the history
  • Loading branch information
glitch452 committed Apr 17, 2024
1 parent 4ac06a4 commit ab1f5cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export NPM_STRICT_SSL="${INPUT_NPM_STRICT_SSL:-"$NPM_STRICT_SSL"}"
NPM_STRICT_SSL="${NPM_STRICT_SSL:-"true"}"
NPM_REGISTRY_SCHEME="https"
if ! [ "$NPM_STRICT_SSL" = "true" ]; then NPM_REGISTRY_SCHEME="http"; fi
NPM_REGISTRY_DOMAIN="$(echo "${NPM_REGISTRY_URL:-registry.npmjs.org}" | sed -r 's/https?:\/\///')"
NPM_REGISTRY_DOMAIN="$(echo "${NPM_REGISTRY_URL:-registry.npmjs.org}" | sed -r 's/https?:\/\///' | sed -r 's/\/+$//')"
NPM_REGISTRY_URL="${NPM_REGISTRY_SCHEME}://$NPM_REGISTRY_DOMAIN"
NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG:-"$HOME/.npmrc"}"

Expand All @@ -40,7 +40,7 @@ if [ -n "$NPM_CUSTOM_NPMRC" ]; then
echo "$NPM_CUSTOM_NPMRC" > "$NPM_CONFIG_USERCONFIG"
chmod 0600 "$NPM_CONFIG_USERCONFIG"
elif [ -n "$NPM_AUTH_TOKEN" ]; then
printf "//%s/:_authToken=%s\\nregistry=%s\\nstrict-ssl=%s" "$NPM_REGISTRY_DOMAIN" "$NPM_AUTH_TOKEN" "$NPM_REGISTRY_URL" "$NPM_STRICT_SSL" > "$NPM_CONFIG_USERCONFIG"
printf "//%s/:_authToken=%s\\nregistry=%s\\nstrict-ssl=%s" "$NPM_REGISTRY_DOMAIN" "$NPM_AUTH_TOKEN" "${NPM_REGISTRY_URL}/" "$NPM_STRICT_SSL" > "$NPM_CONFIG_USERCONFIG"
chmod 0600 "$NPM_CONFIG_USERCONFIG"
fi

Expand Down
5 changes: 4 additions & 1 deletion src/merge-release-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ function isMinorChange(message) {
return minorTagsRegex.test(firstLine);
}

const registryUrl = process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org/';
let registryUrl = process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org/';
if (!registryUrl.endsWith('/')) {
registryUrl = `${registryUrl}/`;
}
const getFromRegistry = bent('json', registryUrl);
const event = JSON.parse(fs.readFileSync('/github/workflow/event.json').toString());
const deployDir = path.join(process.cwd(), process.env.DEPLOY_DIR || '.');
Expand Down

0 comments on commit ab1f5cf

Please sign in to comment.