diff --git a/.github/workflows/reusable-docs-linting.yml b/.github/workflows/reusable-docs-linting.yml index e816659..6b04e69 100644 --- a/.github/workflows/reusable-docs-linting.yml +++ b/.github/workflows/reusable-docs-linting.yml @@ -25,18 +25,30 @@ jobs: exit 1 fi - name: Check whether docs exists and contains a README + id: check-readme run: | if [ -d "./docs" ]; then echo "Folder exists." if [ ! -f "./docs/readme.md" ]; then - echo "❌ docs/readme.md file is missing" - exit 1 + # Check for other markdown files in docs and its subfolders + md_count=$(find ./docs -type f -name "*.md" | wc -l) + if [ "$md_count" -gt 0 ]; then + echo "✅ docs/readme.md is missing, but found $md_count markdown file(s) in docs/." + echo "has_simple_readme=false" >> $GITHUB_OUTPUT + else + echo "❌ docs/readme.md is missing and no other markdown files found in docs/." + exit 1 + fi + else + echo "✅ docs/readme.md exists." + echo "has_simple_readme=true" >> $GITHUB_OUTPUT fi else echo "❌ Folder 'docs' does not exist." exit 1 fi - name: Check for required sections in Documentation + if: steps.check-readme.outputs.has_simple_readme == 'true' run: | patterns=( "#{1,3} Contributing" @@ -53,12 +65,14 @@ jobs: fi done - name: Check for empty sections + if: steps.check-readme.outputs.has_simple_readme == 'true' run: | if grep -Eq "^#+ .+\\n(?:\\n[#+|$]|[#+|$])" docs/readme.md; then echo "Empty section found in docs/readme.md ❌ Please add content" exit 1 fi - name: Check for incomplete sections + if: steps.check-readme.outputs.has_simple_readme == 'true' run: | if grep -Eq "TODO" docs/readme.md; then echo "Found 'TODO' in one or more paragraphs in docs/readme.md ❌ Please add proper content" @@ -76,7 +90,7 @@ jobs: # Download and install packages vale sync # Execute - vale --output=JSON docs/*.md > vale-report.json || true + find ./docs -type f -name "*.md" -print0 | xargs -0 vale --output=JSON > vale-report.json || true - name: Upload Results uses: actions/upload-artifact@v7