From 8f0ce9cdaf1f4cf18d05aecd01751f9448bfd4d5 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 21 Apr 2020 12:41:30 +0200 Subject: [PATCH] remove auth config when no http basic is defined --- src/index.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/index.js b/src/index.js index 940b29d..534681e 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ const core = require("@actions/core"); const axios = require("axios"); -const auth = {} +let auth = undefined let customHeaders = {} if (!!core.getInput('customHeaders')) { @@ -14,12 +14,11 @@ if (!!core.getInput('customHeaders')) { const headers = { 'Content-Type': core.getInput('contentType') || 'application/json' } -if (!!core.getInput('username')) { - auth.username = core.getInput('username'); -} - -if (!!core.getInput('password')) { - auth.password = core.getInput('password'); +if (!!core.getInput('username') || !!core.getInput('password')) { + auth = { + username: core.getInput('username'), + password: core.getInput('password') + } } if (!!core.getInput('bearerToken')) { @@ -32,7 +31,6 @@ const instance = axios.create({ headers: { ...headers, ...customHeaders } }); - (async() => { try { const response = await instance.request({