Skip to content

Publish in custom artifactory #424

Open
@gethari

Description

After spending lot of time, I looked into the code & found that, the regex pattern is always matching for only registries pointing to npm. In my case we have a custom artifactory the URL that looks like //art01.spotifycloud.io

action/src/index.ts

Lines 62 to 64 in 31ff97e

const authLine = userNpmrcContent.split("\n").find((line) => {
// check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);

Suggested solution

we can generalized the Regex and avoid hardcoding

const authLine = userNpmrcContent.split("\n").find((line) => {
  // Dynamically adapt to any registry by looking for :_authToken= pattern
  return /^\s*\/\/.*\/:[_-]authToken=/i.test(line);
});

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions