Fix tests for always-auth

This commit is contained in:
David J. Felix 2019-08-29 19:36:24 -04:00
parent 9c950f557c
commit 17f3fe1837
6 changed files with 36 additions and 32 deletions

View file

@ -12,15 +12,15 @@ const os = __importStar(require("os"));
const path = __importStar(require("path"));
const core = __importStar(require("@actions/core"));
const github = __importStar(require("@actions/github"));
function configAuthentication({ registryUrl, alwaysAuth }) {
function configAuthentication(registryUrl, alwaysAuth) {
const npmrc = path.resolve(process.env['RUNNER_TEMP'] || process.cwd(), '.npmrc');
if (!registryUrl.endsWith('/')) {
registryUrl += '/';
}
writeRegistryToFile({ registryUrl, fileLocation: npmrc, alwaysAuth });
writeRegistryToFile(registryUrl, npmrc, alwaysAuth);
}
exports.configAuthentication = configAuthentication;
function writeRegistryToFile({ registryUrl, fileLocation, alwaysAuth }) {
function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
let scope = core.getInput('scope');
if (!scope && registryUrl.indexOf('npm.pkg.github.com') > -1) {
scope = github.context.repo.owner;

View file

@ -37,7 +37,7 @@ function run() {
const registryUrl = core.getInput('registry-url');
const alwaysAuth = core.getInput('always-auth');
if (registryUrl) {
auth.configAuthentication({ registryUrl, alwaysAuth });
auth.configAuthentication(registryUrl, alwaysAuth);
}
// TODO: setup proxy from runner proxy config
const matchersPath = path.join(__dirname, '..', '.github');