From afaf59e92db26b26262560c20e30cdac0131e1da Mon Sep 17 00:00:00 2001 From: Rd Date: Thu, 3 Oct 2024 18:14:16 +0530 Subject: [PATCH] Added pull-request trigger to check on every PR creation, removed debug lines and removed the confetti emoji filtering --- .github/workflows/wiki.yml | 1 + .../oppia/android/scripts/wiki/WikiTableOfContentsCheck.kt | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wiki.yml b/.github/workflows/wiki.yml index 4568a6469db..1badfd225b3 100644 --- a/.github/workflows/wiki.yml +++ b/.github/workflows/wiki.yml @@ -1,5 +1,6 @@ name: Deploy to Wiki on: + pull_request: push: branches: - develop diff --git a/scripts/src/java/org/oppia/android/scripts/wiki/WikiTableOfContentsCheck.kt b/scripts/src/java/org/oppia/android/scripts/wiki/WikiTableOfContentsCheck.kt index 489ff4e41cc..c634792e7a9 100644 --- a/scripts/src/java/org/oppia/android/scripts/wiki/WikiTableOfContentsCheck.kt +++ b/scripts/src/java/org/oppia/android/scripts/wiki/WikiTableOfContentsCheck.kt @@ -50,7 +50,6 @@ fun checkTableOfContents(file: File) { it.contains(Regex("""##\s+Table\s+of\s+Contents""", RegexOption.IGNORE_CASE)) } if (tocStartIdx == -1) { - println("No Table of Contents found for the file $file") return } @@ -61,7 +60,6 @@ fun checkTableOfContents(file: File) { if (eOfIdx == -1) error("Table of Contents didn't end with a blank line.") val tocSpecificLines = fileContents.subList(tocStartIdx, tocStartIdx + eOfIdx + 1) - println("Toc line: $tocSpecificLines") for (line in tocSpecificLines) { if (line.trimStart().startsWith("- [") && !line.contains("https://")) { @@ -85,7 +83,7 @@ fun validateTableOfContents(file: File, line: String) { val linkRegex = "\\(#(.*?)\\)".toRegex() val link = linkRegex.find(line)?.groupValues?.get(1)?.removePrefix("#")?.replace('-', ' ') ?.replace(Regex("[?&./:’'*!,(){}\\[\\]+]"), "") - ?.replace("confetti_ball", "")?.trim() + ?.trim() // Checks if the table of content title matches with the header link text. val matches = title.equals(link, ignoreCase = true)