From ff2cc698570eab5c9accc168e7de7781bcde6f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Painchaud?= Date: Sat, 4 Jul 2020 10:56:25 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20exclude=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- action.yml | 2 +- entrypoint.sh | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 561d403..056f277 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ Delete files not present in the local folder on the remote folder. Default `"fal ### `exclude` -Ignore file(s) and/or directorie(s). Default `()`. +Ignore file(s) and/or directorie(s). Default `""`. -Fill an array of regex. E.g. `("^logs/", "^README.md")` +Fill an array of regex. E.g. `"'^logs/' '^README.md'"` ### `disable_ssl_certificate_verification` @@ -49,5 +49,5 @@ with: local_source_dir: "dist" dist_target_dir: "www/my-app" delete: "true" - exclude: ("^logs/", "^README.md") + exclude: "'^logs/' '^README.md'" ``` diff --git a/action.yml b/action.yml index 843723d..68e1946 100644 --- a/action.yml +++ b/action.yml @@ -24,7 +24,7 @@ inputs: exclude: description: "Ignore file(s) and/or directorie(s)" required: false - default: () + default: "" disable_ssl_certificate_verification: description: "Disable SSL certificate verification" required: false diff --git a/entrypoint.sh b/entrypoint.sh index 3b2318f..db262b2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,9 @@ #!/bin/sh -l -lftp $INPUT_FTP_HOST -u $INPUT_FTP_USERNAME,$INPUT_FTP_PASSWORD -e "$([ "$INPUT_DISABLE_SSL_CERTIFICATE_VERIFICATION" == true ] && echo "set ssl:verify-certificate false;") mirror --verbose --reverse $([ "$INPUT_DELETE" == true ] && echo "--delete") $INPUT_LOCAL_SOURCE_DIR $INPUT_DIST_TARGET_DIR; exit" \ No newline at end of file +# Construct the exclude commands +for excludedPath in $INPUT_EXCLUDE +do + EXCLUDE="$EXCLUDE --exclude $excludedPath" +done + +lftp $INPUT_FTP_HOST -u $INPUT_FTP_USERNAME,$INPUT_FTP_PASSWORD -e "$([ "$INPUT_DISABLE_SSL_CERTIFICATE_VERIFICATION" == true ] && echo "set ssl:verify-certificate false;") mirror --verbose --reverse $([ "$INPUT_DELETE" == true ] && echo "--delete") $EXCLUDE $INPUT_LOCAL_SOURCE_DIR $INPUT_DIST_TARGET_DIR; exit" \ No newline at end of file