From 57f91df84719eaa2e994f669a8f6e8f5ea1c1f55 Mon Sep 17 00:00:00 2001 From: aireilly Date: Tue, 22 Aug 2023 21:17:14 +0100 Subject: [PATCH] adjust val script --- .travis.yml | 2 +- scripts/check-asciidoctor-build.sh | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b1ce2d602..f6bc65d46d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ jobs: - gem install asciidoctor asciidoctor-diagram rouge - pip3 install pyyaml aura.tar.gz script: - # Fail if Asciidoctor encounters errors. Run only if there are modified AsciiDoc files + # Fail if Asciidoctor encounters errors. Pass otherwise. Run only if there are modified AsciiDoc files - if ! [[ -z $(git diff --name-only HEAD~1 HEAD --diff-filter=d '*.adoc' ':(exclude)_unused_topics/*') ]]; then chmod +x ./scripts/check-asciidoctor-build.sh && ./scripts/check-asciidoctor-build.sh; fi - stage: build diff --git a/scripts/check-asciidoctor-build.sh b/scripts/check-asciidoctor-build.sh index f449721db4..d9517a103d 100755 --- a/scripts/check-asciidoctor-build.sh +++ b/scripts/check-asciidoctor-build.sh @@ -21,6 +21,11 @@ check_updated_assemblies () { then # $UPDATED_ASSEMBLIES is the list of assemblies that contains changed modules UPDATED_ASSEMBLIES=$(grep -rnwl "$REPO_PATH" --include=\*.adoc --exclude-dir={snippets,modules} -e "$MODULES") + # Exit 0 if there are no modified assemblies + if [[ -z "${UPDATED_ASSEMBLIES}" ]] + then + exit 0 + fi # subtract $REPO_PATH from path with bash substring replacement UPDATED_ASSEMBLIES=${UPDATED_ASSEMBLIES//"$REPO_PATH/"/} fi @@ -51,15 +56,15 @@ check_updated_assemblies () { update_log () { echo "" - echo "************************************************************************" + echo "****************************************************************************" echo "" - echo "Validating all AsciiDoc files that are included in the pull request. 🕵" - echo "Other assemblies that include the modifed modules are also validated. 🙀" - echo "This might include assemblies that are not in the pull request. 🤬" - echo "Validation will fail with FAILED, ERROR, or WARNING messages. ❌" - echo "Correct all reported AsciiDoc errors to pass the validation build. 🤟" + echo "Validating all AsciiDoc assemblies that are modifed by the pull request. 🕵" + echo "All assemblies that include modifed modules are validated. 🙀" + echo "This might include assemblies that are not in the pull request! 🤬" + echo "Validation will fail with FAILED, ERROR, or WARNING messages. ❌" + echo "Correct all reported AsciiDoc errors to pass the validation build. 🤟" echo "" - echo "************************************************************************" + echo "****************************************************************************" echo "" }