Skip to content

Commit 813970f

Browse files
authored
Merge pull request #60705 from aireilly/fix-adoc-validate
Two smol fixes for the Asciidoctor validate script
2 parents 5b57c82 + f73d924 commit 813970f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

scripts/check-asciidoctor-build.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ then
1010
fi
1111

1212
# get the *.adoc modules and assemblies in the pull request
13-
FILES=$(git diff --name-only HEAD~1 HEAD --diff-filter=d "*.adoc")
13+
FILES=$(git diff --name-only HEAD~1 HEAD --diff-filter=d "*.adoc" ':(exclude)_unused_topics/*')
1414

1515
REPO_PATH=$(git rev-parse --show-toplevel)
1616

@@ -28,9 +28,19 @@ check_updated_assemblies () {
2828
ASSEMBLIES=$(echo "$FILES" | awk '!/modules\/(.*)\.adoc/')
2929
# concatenate both lists and remove dupe entries
3030
ALL_ASSEMBLIES=$(echo "$UPDATED_ASSEMBLIES $ASSEMBLIES" | tr ' ' '\n' | sort -u)
31-
# validate the assemblies
32-
echo "Validating updated assemblies. Validation will fail with FAILED, ERROR, or WARNING messages..."
33-
asciidoctor $ALL_ASSEMBLIES -a icons! -o /dev/null -v --failure-level WARN
31+
# check that assemblies are in a topic_map
32+
for ASSEMBLY in $ALL_ASSEMBLIES; do
33+
# get the page name to search the topic_map
34+
PAGE=$(basename "$ASSEMBLY" .adoc)
35+
# don't validate the assembly if it is not in a topic map
36+
if grep -rq "$PAGE" --include "*.yml" _topic_maps ; then
37+
# validate the assembly
38+
echo "Validating $ASSEMBLY. Validation will fail with FAILED, ERROR, or WARNING messages..."
39+
asciidoctor "$ASSEMBLY" -a icons! -o /dev/null -v --failure-level WARN
40+
else
41+
echo "$ASSEMBLY is not in a topic_map"
42+
fi
43+
done
3444
}
3545

3646
# check assemblies and fail if errors are reported

0 commit comments

Comments
 (0)