mirror of
				https://github.com/SamKirkland/FTP-Deploy-Action.git
				synced 2025-10-31 19:24:00 +00:00 
			
		
		
		
	more optional props
This commit is contained in:
		
							parent
							
								
									fc9de49cd2
								
							
						
					
					
						commit
						4fe6844638
					
				| @ -74,6 +74,7 @@ I strongly recommend you store your `password` as a secret. | ||||
| | `include`               | No       |                            | ``                                                       | :warning: not implemented yet - An array of glob patterns, these files will always be included in the publish/delete process - even if no change occurred    | | ||||
| | `exclude`               | No       |                            | `.git*` `.git*/**` `node_modules/**` `node_modules/**/*` | An array of glob patterns, these files will not be included in the publish/delete process                                                                    | | ||||
| | `log-level`             | No       | `info`                     | `info`                                                   | `warn`: only important/warning info, `info`: default, log important/warning info & progress info, `debug`: log everything for debugging                      | | ||||
| | `security`              | No       | `strict`                   | `loose`                                                  | `strict`: Reject any connection which is not authorized with the list of supplied CAs. `loose`: Allow connection even when the domain is not certificate     | | ||||
| 
 | ||||
| 
 | ||||
| # Common Examples | ||||
|  | ||||
							
								
								
									
										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
 | ||||
|  | ||||
							
								
								
									
										52
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -9,14 +9,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")) | ||||
|   }; | ||||
| 
 | ||||
| 
 | ||||
| @ -36,10 +37,16 @@ runDeployment(); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| function optionalString(rawValue: string): string | undefined { | ||||
|   if (rawValue.length === 0) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
|   return rawValue; | ||||
| } | ||||
| 
 | ||||
| function optionalBoolean(argumentName: string, rawValue: string | undefined): boolean | undefined { | ||||
|   if (rawValue === undefined) { | ||||
| function optionalBoolean(argumentName: string, rawValue: string): boolean | undefined { | ||||
|   if (rawValue.length === 0) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
| @ -54,8 +61,8 @@ function optionalBoolean(argumentName: string, rawValue: string | undefined): bo | ||||
|   core.setFailed(`${argumentName}: invalid parameter - please use a boolean, you provided "${rawValue}". Try true or false instead.`); | ||||
| } | ||||
| 
 | ||||
| function optionalProtocol(argumentName: string, rawValue: string | undefined): "ftp" | "ftps" | "ftps-legacy" | undefined { | ||||
|   if (rawValue === undefined) { | ||||
| function optionalProtocol(argumentName: string, rawValue: string): "ftp" | "ftps" | "ftps-legacy" | undefined { | ||||
|   if (rawValue.length === 0) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
| @ -73,8 +80,8 @@ function optionalProtocol(argumentName: string, rawValue: string | undefined): " | ||||
|   core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "ftp", "ftps", or "ftps-legacy" instead.`); | ||||
| } | ||||
| 
 | ||||
| function optionalLogLevel(argumentName: string, rawValue: string | undefined): "warn" | "info" | "debug" | undefined { | ||||
|   if (rawValue === undefined) { | ||||
| function optionalLogLevel(argumentName: string, rawValue: string): "warn" | "info" | "debug" | undefined { | ||||
|   if (rawValue.length === 0) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
| @ -92,13 +99,28 @@ function optionalLogLevel(argumentName: string, rawValue: string | undefined): " | ||||
|   core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "warn", "info", or "debug" instead.`); | ||||
| } | ||||
| 
 | ||||
| function optionalInt(argumentName: string, rawValue: string | undefined): number | undefined { | ||||
|   if (rawValue === undefined) { | ||||
| function optionalSecurity(argumentName: string, rawValue: string): "loose" | "strict" | undefined { | ||||
|   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: string, rawValue: string): number | undefined { | ||||
|   if (rawValue.length === 0) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
|   const valueAsNumber = parseFloat(rawValue); | ||||
| 
 | ||||
|   if (Number.isInteger(valueAsNumber)) { | ||||
|     return valueAsNumber; | ||||
| @ -107,8 +129,8 @@ function optionalInt(argumentName: string, rawValue: string | undefined): number | ||||
|   core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try a whole number (no decimals) instead like 1234`); | ||||
| } | ||||
| 
 | ||||
| function optionalStringArray(argumentName: string, rawValue: string | undefined): string[] | undefined { | ||||
|   if (rawValue === undefined) { | ||||
| function optionalStringArray(argumentName: string, rawValue: string): string[] | undefined { | ||||
|   if (rawValue.length === 0) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user