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:
authorEvan Read <eread@gitlab.com>2022-08-02 02:02:02 +0300
committerEvan Read <eread@gitlab.com>2022-08-30 03:22:16 +0300
commit8451aa75732c7a4def64f39f7ab194d21e9aaddf (patch)
tree27220ed47a61101b7753268f84b3ada27453dcb6 /scripts
parent18121b714288fec6b9cd7a28ffae3bce7a2e4222 (diff)
Add check for identical duplicate entries in global navigationeread/add-duplicate-nav-entry-check
Diffstat (limited to 'scripts')
-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