Skip to content

Commit

Permalink
fix: docs check should restore original file
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-FFFFFF committed Jan 29, 2024
1 parent 0e9971d commit 72078e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions avm_scripts/docs-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ check_example_docs () {
echo "===> Comparing examples documentation in $dir"
if [ ! -z "$(diff -q "$dir/README.md" "$dir/README-generated.md")" ]; then
echo "==> examples/$dir/README.md is out of date. Run 'make pre-commit' to update the generated document and commit."
rm -f "$dir/README-generated.md"
mv -f "$dir/README-generated.md" "$dir/README.md"
exit 1
fi
rm -f "$dir/README-generated.md"
Expand All @@ -24,15 +24,14 @@ terraform-docs -c .terraform-docs.yml .
echo "==> Comparing generated code to committed code..."
if [ ! -z "$(diff -q README.md README-generated.md)" ]; then
echo "==> README.md is out of date. Run 'make pre-commit' to update the generated document and commit."
rm -f README-generated.md
mv -f README-generated.md README.md
exit 1
fi
rm -f README-generated.md

cd examples
subexamples=$(find ./ -maxdepth 1 -mindepth 1 -type d)
for d in $subexamples; do
check_example_docs $d
done
cd ..

rm -f README-generated.md
7 changes: 3 additions & 4 deletions avm_scripts_canary/docs-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ check_example_docs () {
echo "===> Comparing examples documentation in $dir"
if [ ! -z "$(diff -q "$dir/README.md" "$dir/README-generated.md")" ]; then
echo "==> examples/$dir/README.md is out of date. Run 'make pre-commit' to update the generated document and commit."
rm -f "$dir/README-generated.md"
mv -f "$dir/README-generated.md" "$dir/README.md"
exit 1
fi
rm -f "$dir/README-generated.md"
Expand All @@ -24,15 +24,14 @@ terraform-docs -c .terraform-docs.yml .
echo "==> Comparing generated code to committed code..."
if [ ! -z "$(diff -q README.md README-generated.md)" ]; then
echo "==> README.md is out of date. Run 'make pre-commit' to update the generated document and commit."
rm -f README-generated.md
mv -f README-generated.md README.md
exit 1
fi
rm -f README-generated.md

cd examples
subexamples=$(find ./ -maxdepth 1 -mindepth 1 -type d)
for d in $subexamples; do
check_example_docs $d
done
cd ..

rm -f README-generated.md

0 comments on commit 72078e7

Please sign in to comment.