1
1
#! /bin/bash
2
-
3
2
# Returns a list of updated _topic_map.yml files.
4
3
# The list includes any topic maps that are themselves modified, and indirectly modifed topic maps where incldued AsciiDoc files have been updated.
5
4
@@ -12,12 +11,12 @@ REPO_PATH=$(git rev-parse --show-toplevel)
12
11
DISTROS=()
13
12
14
13
# Get the modules in the PR, search for assemblies that include them, and concat with any updated assemblies files
15
-
16
14
MODULES=$( echo " $FILES " | awk ' /modules\/(.*)\.adoc/' )
17
15
if [ " ${MODULES} " ]
18
16
then
19
17
# $UPDATED_ASSEMBLIES is the list of assemblies that contains changed modules
20
- UPDATED_ASSEMBLIES=$( grep -rnwl " $REPO_PATH " --include=\* .adoc --exclude-dir={snippets,modules} -e " $MODULES " )
18
+ UPDATED_ASSEMBLIES=$( grep -rnwL " $REPO_PATH " --exclude-dir={snippets,modules} -e " $MODULES " -- " *.adoc" )
19
+
21
20
# Exit 0 if there are no modified assemblies
22
21
if [[ -z " ${UPDATED_ASSEMBLIES} " ]]
23
22
then
26
25
# Subtract $REPO_PATH from path with bash substring replacement
27
26
UPDATED_ASSEMBLIES=${UPDATED_ASSEMBLIES// " $REPO_PATH /" / }
28
27
fi
28
+
29
29
# ASSEMBLIES is the list of modifed assemblies
30
30
ASSEMBLIES=$( echo " $FILES " | awk ' !/modules\/(.*)\.adoc/' )
31
31
# Concatenate both lists and remove dupe entries
@@ -36,8 +36,8 @@ for ASSEMBLY in $ALL_ASSEMBLIES; do
36
36
# Search for files only, not folders
37
37
PAGE=" File: $( basename " $ASSEMBLY " .adoc) "
38
38
# Don't include the assembly if it is not in a topic map
39
- if grep -rq " $PAGE " --include " *.yml" _topic_maps ; then
40
- DISTROS+=(" $( grep -rl " $PAGE " --include " *.yml" _topic_maps ) " )
39
+ if grep -rq " $PAGE " _topic_maps/ * .yml; then
40
+ DISTROS+=(" $( grep -rl " $PAGE " _topic_maps/ * .yml) " )
41
41
fi
42
42
done
43
43
0 commit comments