Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/check-navigation.sh')
-rwxr-xr-xscripts/check-navigation.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/check-navigation.sh b/scripts/check-navigation.sh
new file mode 100755
index 00000000..69f4a9a6
--- /dev/null
+++ b/scripts/check-navigation.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+COLOR_RED="\e[31m"
+COLOR_GREEN="\e[32m"
+COLOR_RESET="\e[39m"
+
+DUPLICATED_NAV_ENTRIES=$(sed -n -E "s/.*[section|category|doc|]_url: '(.*)'/\1/p" content/_data/navigation.yaml | sort | uniq -d)
+
+printf "${COLOR_GREEN}INFO: Checking for identical duplicate global navigation entries...${COLOR_RESET}\n"
+
+if [[ -n $DUPLICATED_NAV_ENTRIES ]]; then
+ for DUPLICATED_NAV_ENTRY in $DUPLICATED_NAV_ENTRIES; do
+ printf "${COLOR_RED}ERROR (identical duplicate entry):${COLOR_RESET} %s\n" "${DUPLICATED_NAV_ENTRY}"
+ done
+ exit 1
+else
+ printf "${COLOR_GREEN}INFO: No identical duplicate entries found!${COLOR_RESET}\n"
+ exit 0
+fi