Added field key to validation message

main
GarryOne 2020-03-25 05:20:29 +02:00
parent ff832e4e77
commit 82ccbba7dc
2 changed files with 8 additions and 6 deletions

7
dist/index.js vendored
View File

@ -596,9 +596,10 @@ const sshDeploy = (() => {
})(); })();
const validateInputs = (inputs) => { const validateInputs = (inputs) => {
const validInputs = inputs.filter(input => { const validInputs = Object.keys(inputs).filter((key) => {
const input = inputs[key];
if (!input) { if (!input) {
console.error(`⚠️ ${input} is mandatory`); console.error(`⚠️ ${key} is mandatory`);
} }
return input; return input;
@ -610,7 +611,7 @@ const validateInputs = (inputs) => {
}; };
const run = () => { const run = () => {
validateInputs([SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER]); validateInputs({SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER});
sshDeploy.init({ sshDeploy.init({
src: GITHUB_WORKSPACE + '/' + SOURCE || '', src: GITHUB_WORKSPACE + '/' + SOURCE || '',

View File

@ -121,9 +121,10 @@ const sshDeploy = (() => {
})(); })();
const validateInputs = (inputs) => { const validateInputs = (inputs) => {
const validInputs = inputs.filter(input => { const validInputs = Object.keys(inputs).filter((key) => {
const input = inputs[key];
if (!input) { if (!input) {
console.error(`⚠️ ${input} is mandatory`); console.error(`⚠️ ${key} is mandatory`);
} }
return input; return input;
@ -135,7 +136,7 @@ const validateInputs = (inputs) => {
}; };
const run = () => { const run = () => {
validateInputs([SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER]); validateInputs({SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER});
sshDeploy.init({ sshDeploy.init({
src: GITHUB_WORKSPACE + '/' + SOURCE || '', src: GITHUB_WORKSPACE + '/' + SOURCE || '',