diff --git a/.github/workflows/wiki.yml b/.github/workflows/wiki.yml index 5f7f34a13d1..4568a6469db 100644 --- a/.github/workflows/wiki.yml +++ b/.github/workflows/wiki.yml @@ -14,15 +14,13 @@ jobs: # To verify that the wiki's table of contents matches the headers accurately. name: Check Wiki Table of Contents runs-on: ubuntu-20.04 - env: - CACHE_DIRECTORY: ~/.bazel_cache steps: - uses: actions/checkout@v2 - name: Set up Bazel uses: abhinavsingh/setup-bazel@v3 with: - version: 4.0.0 + version: 6.5.0 - name: Check Wiki Table of Contents id: checkWikiToc 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 18cb650f1f8..489ff4e41cc 100644 --- a/scripts/src/java/org/oppia/android/scripts/wiki/WikiTableOfContentsCheck.kt +++ b/scripts/src/java/org/oppia/android/scripts/wiki/WikiTableOfContentsCheck.kt @@ -47,7 +47,7 @@ fun processWikiDirectory(wikiDir: File) { fun checkTableOfContents(file: File) { val fileContents = file.readLines() val tocStartIdx = fileContents.indexOfFirst { - it.contains("## Table of Contents") + 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") @@ -58,7 +58,7 @@ fun checkTableOfContents(file: File) { val eOfIdx = fileContents.subList(tocStartIdx + 2, fileContents.size).indexOfFirst { it.isBlank() } - if (eOfIdx == -1) error("Table of Contents didn't end with a blank line") + 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")