Skip to content

Commit

Permalink
Upgraded the Bazel version, removed cache env, used Regex to check he…
Browse files Browse the repository at this point in the history
…ading text
  • Loading branch information
Rd4dev committed Oct 2, 2024
1 parent 72d0a2b commit b5c9cf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit b5c9cf3

Please sign in to comment.