Skip to content

Commit

Permalink
Add script for verifying docs without entry
Browse files Browse the repository at this point in the history
  • Loading branch information
janetkuo committed Dec 28, 2016
1 parent da5c6e4 commit 2f16fce
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ install:
script:
- go test -v k8s.io/kubernetes.github.io/test
- $GOPATH/bin/md-check --root-dir=$HOME/gopath/src/k8s.io/kubernetes.github.io
- ./verify-entry-toc.sh
3 changes: 3 additions & 0 deletions skip_toc_check.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Put files you want to skip table of contents entry check here:
docs/search.md
docs/sitemap.md
20 changes: 20 additions & 0 deletions verify-entry-toc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

no_entry=false

# Verify all docs/.../*.md files are referenced in at least one of _data/*.yml
# files. Skip checking files in skip_toc_check.txt
for file in `find docs -name "*.md" -type f`; do
if ! grep -q "${file}" skip_toc_check.txt; then
path=${file%.*}
if ! grep -q "${path}" _data/*.yml; then
echo "Error: ${file} doesn't have an entry in the table of contents under _data/*.yml"
no_entry=true
fi
fi
done

if ${no_entry}; then
echo "Found files without entries. For how to fix it, see http://kubernetes.io/docs/contribute/write-new-topic/#creating-an-entry-in-the-table-of-contents"
exit 1
fi

0 comments on commit 2f16fce

Please sign in to comment.