Skip to content

Commit 75f4337

Browse files
authored
scripts/set-alias-page.py: fix "page updated" spam when it wasn't being updated (#19941)
1 parent 7113626 commit 75f4337

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

scripts/set-alias-page.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,19 @@ def get_alias_command_in_page(path: Path, alias_pattern: str) -> AliasPageConten
269269
if len(command_lines) != 2 or not title:
270270
return AliasPageContent(title="", original_command="", documentation_command="")
271271

272-
stripped_template = config.templates["en"].replace("example", "")
273-
stripped_en = content
274-
stripped_en = re.sub(r"#.*", "# ", stripped_en)
275-
stripped_en = re.sub(r"`(?!tldr).*`", "``", stripped_en)
276-
stripped_en = re.sub(r"`tldr .*`", "`tldr `", stripped_en)
277-
278-
if stripped_template != stripped_en:
279-
return AliasPageContent(title="", original_command="", documentation_command="")
272+
if alias_pattern == get_locale_alias_pattern("en"):
273+
stripped_template = config.templates["en"]
274+
stripped_template = stripped_template.replace("example", "")
275+
276+
stripped_en = content
277+
stripped_en = re.sub(r"#.*", "# ", stripped_en)
278+
stripped_en = re.sub(r"`(?!tldr).*`", "``", stripped_en)
279+
stripped_en = re.sub(r"`tldr .*`", "`tldr `", stripped_en)
280+
281+
if stripped_template != stripped_en:
282+
return AliasPageContent(
283+
title="", original_command="", documentation_command=""
284+
)
280285

281286
original_command = ""
282287
documentation_command = ""

0 commit comments

Comments
 (0)