Add logging around to find issue

This commit is contained in:
Edward Romero 2020-06-23 20:34:30 -04:00
parent f05d7045cd
commit 527b66817c
2 changed files with 5 additions and 1 deletions

View file

@ -35,6 +35,7 @@ async function getAuthToken(
maxRetries: 3 maxRetries: 3
}); });
let response: hc.HttpClientResponse = await httpClient.get(authUrl); let response: hc.HttpClientResponse = await httpClient.get(authUrl);
console.log(response);
let body: string = await response.readBody(); let body: string = await response.readBody();
core.info(body); core.info(body);
let data: any = JSON.parse(body); let data: any = JSON.parse(body);
@ -48,6 +49,7 @@ async function writeRegistryToFile(
alwaysAuth: string alwaysAuth: string
) { ) {
let scope: string = core.getInput('scope'); let scope: string = core.getInput('scope');
console.log(`scope: ${scope}`);
if (!scope && registryUrl.indexOf('npm.pkg.github.com') > -1) { if (!scope && registryUrl.indexOf('npm.pkg.github.com') > -1) {
scope = github.context.repo.owner; scope = github.context.repo.owner;
} }
@ -58,7 +60,7 @@ async function writeRegistryToFile(
scope = scope.toLowerCase(); scope = scope.toLowerCase();
} }
core.info(`Setting auth in ${fileLocation}`); console.log(`Setting auth in ${fileLocation}`);
let newContents: string = ''; let newContents: string = '';
if (fs.existsSync(fileLocation)) { if (fs.existsSync(fileLocation)) {
const curContents: string = fs.readFileSync(fileLocation, 'utf8'); const curContents: string = fs.readFileSync(fileLocation, 'utf8');
@ -74,6 +76,7 @@ async function writeRegistryToFile(
// Check if auth url provided // Check if auth url provided
const authUrl: string = core.getInput('auth-url'); const authUrl: string = core.getInput('auth-url');
if (authUrl) { if (authUrl) {
console.log(`authUrl: ${authUrl}`);
// Check if username and password/token provided // Check if username and password/token provided
const authUser: string = core.getInput('auth-user'); const authUser: string = core.getInput('auth-user');
const authPassword: string = core.getInput('auth-password'); const authPassword: string = core.getInput('auth-password');

View file

@ -26,6 +26,7 @@ export async function run() {
const registryUrl: string = core.getInput('registry-url'); const registryUrl: string = core.getInput('registry-url');
const alwaysAuth: string = core.getInput('always-auth'); const alwaysAuth: string = core.getInput('always-auth');
if (registryUrl) { if (registryUrl) {
console.log(`registryUrl: ${registryUrl}`);
await auth.configAuthentication(registryUrl, alwaysAuth); await auth.configAuthentication(registryUrl, alwaysAuth);
} }