From 75d9f61819e7ad571b8dc92ad60110c183f02173 Mon Sep 17 00:00:00 2001 From: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Date: Sun, 12 Nov 2023 10:48:15 +0100 Subject: [PATCH] check-pr: add check to see if English page exists (#11470) --- scripts/check-pr.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/check-pr.sh b/scripts/check-pr.sh index 82c045b42..e9e588ffe 100755 --- a/scripts/check-pr.sh +++ b/scripts/check-pr.sh @@ -9,7 +9,8 @@ # they already exist under 'common'. # 3. Detect pages that were added in the 'common' platform although they # already exist under a platform specific directory. -# 4. Detect other miscellaneous anomalies in the pages folder. +# 4. Detect pages that do not exist as English pages yet. +# 5. Detect other miscellaneous anomalies in the pages folder. # # Results are printed to stdout, logs and errors to stderr. # @@ -44,6 +45,15 @@ function check_duplicates { esac } +function check_missing_english_page() { + local page="$1" + local english_page="pages/${page#pages*\/}" + + if [[ ! -f "$english_page" ]]; then + printf "\x2d $MSG_NOT_EXISTS" "$page" "$english_page" + fi +} + # Look at git diff and check for copied/duplicated pages. function check_diff { local git_diff @@ -77,6 +87,7 @@ function check_diff { A) # file1 was newly added check_duplicates "$file1" + check_missing_english_page "$file1" ;; esac done <<< "$git_diff" @@ -104,6 +115,7 @@ function check_structure { ################################### MSG_EXISTS='The page `%s` already exists under the `%s` platform.\n' +MSG_NOT_EXISTS='The page `%s` does not exists as English page `%s` yet.\n' MSG_IS_COPY='The page `%s` seems to be a copy of `%s` (%d%% matching).\n' MSG_NOT_DIR='The file `%s` does not look like a directory.\n' MSG_NOT_FILE='The file `%s` does not look like a regular file.\n'