diff --git a/entrypoint.sh b/entrypoint.sh index 906d4d4..e99241d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -20,16 +20,18 @@ if [[ ${INPUT_SUBFOLDER} != '' ]]; then echo "NEW github pages url ${GITHUB_PAGES_WEBSITE_URL}" fi -echo "count folders in allure-history" -echo $( ( ls ./${INPUT_ALLURE_HISTORY} | wc -l ) ) -echo "keep reports count ${INPUT_KEEP_REPORTS} $((INPUT_KEEP_REPORTS+1))" -if [[ $((INPUT_KEEP_REPORTS+1)) < $( ( ls ./${INPUT_ALLURE_HISTORY} | wc -l ) ) ]]; then +COUNT=$( ( ls ./${INPUT_ALLURE_HISTORY} | wc -l ) ) +echo "count folders in allure-history: ${COUNT}" +echo "keep reports count ${INPUT_KEEP_REPORTS}" +INPUT_KEEP_REPORTS=$((INPUT_KEEP_REPORTS+1)) +echo "if ${COUNT} > ${INPUT_KEEP_REPORTS}" +if (( COUNT > INPUT_KEEP_REPORTS )); then cd ./${INPUT_ALLURE_HISTORY} echo "remove index.html last-history" rm index.html last-history -rv echo "remove old reports" - ls | sort -n | head -n -$((${INPUT_KEEP_REPORTS}-1)) | xargs rm -rv; - cd .. + ls | sort -n | head -n -$((${INPUT_KEEP_REPORTS}-2)) | xargs rm -rv; + cd ${GITHUB_WORKSPACE} fi #echo "index.html"