Added test script for ensuring docs are up to date. (#672)
* Added test script for ensuring docs are up to date.
* Fixed bug in doc attribute formatting.
* Regenerate documentation
* `_tidy` now ignores empty first lines
* Updated comment
* Regenerate documentation
diff --git a/docs/update_docs.sh b/docs/update_docs.sh
index 569cd8b..d43d85a 100755
--- a/docs/update_docs.sh
+++ b/docs/update_docs.sh
@@ -1,6 +1,15 @@
#!/bin/bash
-pushd ${0%/*}
+set -euo pipefail
+
+if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
+ DOCS_WORKSPACE="${BUILD_WORKSPACE_DIRECTORY}"
+else
+ # https://stackoverflow.com/a/246128/7768383
+ DOCS_WORKSPACE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+fi
+
+pushd "${DOCS_WORKSPACE}" &> /dev/null
# It's important to clean the workspace so we don't end up with unintended
# docs artifacts in the new commit.
bazel clean \
@@ -9,5 +18,5 @@
&& chmod 0644 *.md \
&& git add *.md \
&& git commit -m "Regenerate documentation"
-popd
+popd &> /dev/null