23 lines
628 B
Bash
Executable file
23 lines
628 B
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
# This script is run before each commit on the repo and will try to fix linting
|
|
# issues of the documentation.
|
|
|
|
# This is run from ./docs folder, we need to go back to the git root to run the
|
|
# git methods
|
|
cd ../ || exit 1
|
|
|
|
# We only run the auto-fix when changes are actually made to markdown files
|
|
git diff --name-status master | grep '^\(.*\)docs/\(.*\).md$' 1>/dev/null
|
|
DOCS_FOLDER_HAS_CHANGED=$?
|
|
if [ "$DOCS_FOLDER_HAS_CHANGED" = "1" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
echo "Markdown documentation updated."
|
|
echo "Running auto-lint..."
|
|
cd ./docs || exit 1
|
|
yarn run lint:md:fix
|
|
|
|
cd ../ || exit 1
|
|
git add ./docs/**/*.md
|