scripts/check-pr.sh: add header check (#20212)

Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
This commit is contained in:
Managor
2025-12-23 08:29:32 +02:00
committed by GitHub
co-authored by Sebastiaan Speck
parent 8180331ef2
commit 7bfa274864
+14
View File
@@ -87,6 +87,13 @@ function count_commands() {
grep -c "$regex" "$file"
}
count_header() {
local file="$1"
local regex="$2"
grep -c "$regex" "$file"
}
function strip_commands() {
local file="$1"
local regex="$2"
@@ -112,6 +119,7 @@ function check_outdated_page() {
local page="$1"
local english_page="pages/${page#pages*\/}"
local command_regex='^`[^`]\+`$'
local header_regex='^>.*$'
if [[ $page == "$english_page" || ! -f $english_page ]]; then
return 1
@@ -128,6 +136,12 @@ function check_outdated_page() {
elif [[ "$english_commands_as_string" != "$commands_as_string" ]]; then
printf "\x2d $MSG_OUTDATED" "$page" "based on the command contents itself"
fi
english_header_lines=$(count_header "$english_page" "$header_regex")
header_lines=$(count_header "$page" "$header_regex")
if [[ "$english_header_lines" != "$header_lines" ]]; then
printf "\x2d $MSG_OUTDATED" "$page" "based on number of header lines"
fi
}
function check_more_info_link() {