mirror of
https://github.com/SamKirkland/FTP-Deploy-Action.git
synced 2026-04-10 12:32:17 +02:00
more optional props
This commit is contained in:
41
dist/index.js
vendored
41
dist/index.js
vendored
@@ -6803,14 +6803,15 @@ async function runDeployment() {
|
||||
password: core.getInput("password", { required: true }),
|
||||
protocol: optionalProtocol("protocol", core.getInput("protocol")),
|
||||
port: optionalInt("port", core.getInput("port")),
|
||||
"local-dir": core.getInput("local-dir"),
|
||||
"server-dir": core.getInput("server-dir"),
|
||||
"state-name": core.getInput("state-name"),
|
||||
"local-dir": optionalString(core.getInput("local-dir")),
|
||||
"server-dir": optionalString(core.getInput("server-dir")),
|
||||
"state-name": optionalString(core.getInput("state-name")),
|
||||
"dry-run": optionalBoolean("dry-run", core.getInput("dry-run")),
|
||||
"dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
|
||||
"include": optionalStringArray("include", core.getInput("include")),
|
||||
"exclude": optionalStringArray("exclude", core.getInput("exclude")),
|
||||
"log-level": optionalLogLevel("log-level", core.getInput("log-level"))
|
||||
"log-level": optionalLogLevel("log-level", core.getInput("log-level")),
|
||||
"security": optionalSecurity("security", core.getInput("security"))
|
||||
};
|
||||
try {
|
||||
await ftp_deploy_1.deploy(args);
|
||||
@@ -6820,8 +6821,14 @@ async function runDeployment() {
|
||||
}
|
||||
}
|
||||
runDeployment();
|
||||
function optionalString(rawValue) {
|
||||
if (rawValue.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return rawValue;
|
||||
}
|
||||
function optionalBoolean(argumentName, rawValue) {
|
||||
if (rawValue === undefined) {
|
||||
if (rawValue.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const cleanValue = rawValue.toLowerCase();
|
||||
@@ -6834,7 +6841,7 @@ function optionalBoolean(argumentName, rawValue) {
|
||||
core.setFailed(`${argumentName}: invalid parameter - please use a boolean, you provided "${rawValue}". Try true or false instead.`);
|
||||
}
|
||||
function optionalProtocol(argumentName, rawValue) {
|
||||
if (rawValue === undefined) {
|
||||
if (rawValue.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const cleanValue = rawValue.toLowerCase();
|
||||
@@ -6850,7 +6857,7 @@ function optionalProtocol(argumentName, rawValue) {
|
||||
core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "ftp", "ftps", or "ftps-legacy" instead.`);
|
||||
}
|
||||
function optionalLogLevel(argumentName, rawValue) {
|
||||
if (rawValue === undefined) {
|
||||
if (rawValue.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const cleanValue = rawValue.toLowerCase();
|
||||
@@ -6865,19 +6872,31 @@ function optionalLogLevel(argumentName, rawValue) {
|
||||
}
|
||||
core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "warn", "info", or "debug" instead.`);
|
||||
}
|
||||
function optionalInt(argumentName, rawValue) {
|
||||
if (rawValue === undefined) {
|
||||
function optionalSecurity(argumentName, rawValue) {
|
||||
if (rawValue.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const cleanValue = rawValue.toLowerCase();
|
||||
const valueAsNumber = parseFloat(cleanValue);
|
||||
if (cleanValue === "loose") {
|
||||
return "loose";
|
||||
}
|
||||
if (cleanValue === "strict") {
|
||||
return "strict";
|
||||
}
|
||||
core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "loose" or "strict" instead.`);
|
||||
}
|
||||
function optionalInt(argumentName, rawValue) {
|
||||
if (rawValue.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const valueAsNumber = parseFloat(rawValue);
|
||||
if (Number.isInteger(valueAsNumber)) {
|
||||
return valueAsNumber;
|
||||
}
|
||||
core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try a whole number (no decimals) instead like 1234`);
|
||||
}
|
||||
function optionalStringArray(argumentName, rawValue) {
|
||||
if (rawValue === undefined) {
|
||||
if (rawValue.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
// split value by space and comma
|
||||
|
||||
Reference in New Issue
Block a user