Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(repo): fix monorepo readme links #18637

Merged
merged 27 commits into from
Dec 24, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add workflow
  • Loading branch information
dionysuzx committed Dec 23, 2024
commit 2a298f00279e710f06f62ae4d643119cd8074688
58 changes: 58 additions & 0 deletions .github/workflows/repo--validate-package-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Validate Package Docs

on:
pull_request:
paths:
- '**/README.md'
- 'packages/*/'

jobs:
validate:
runs-on: ubuntu-latest
env:
EXPECTED_PACKAGE_COUNT: 18 # Update this when packages are added/removed
steps:
- uses: actions/checkout@v4

- name: Validate packages
run: |
# Get current package count
CURRENT_COUNT=$(ls -d packages/*/ | wc -l | tr -d ' ')
if [ "$CURRENT_COUNT" != "$EXPECTED_PACKAGE_COUNT" ]; then
echo "❌ Package count mismatch! Expected $EXPECTED_PACKAGE_COUNT but found $CURRENT_COUNT"
echo "Update EXPECTED_PACKAGE_COUNT in workflow if this was intentional"
exit 1
fi

# Get package lists
PACKAGES=$(ls -d packages/*/ | cut -f2 -d'/' | sort)
README_PACKAGES=$(grep -o '\[.*\]([^)]*/packages/[^)]*)' README.md | sed -E 's/.*packages\/([^/)]*).*/\1/' | sort)

if [ -z "$README_PACKAGES" ]; then
echo "❌ No package links found in README.md. Table might be malformed."
exit 1
fi

# Check for mismatches
MISSING_IN_README=$(comm -23 <(echo "$PACKAGES") <(echo "$README_PACKAGES"))
EXTRA_IN_README=$(comm -13 <(echo "$PACKAGES") <(echo "$README_PACKAGES"))

if [ ! -z "$MISSING_IN_README" ]; then
echo "❌ Packages not documented in README.md: $MISSING_IN_README"
exit 1
fi

if [ ! -z "$EXTRA_IN_README" ]; then
echo "❌ Non-existent packages in README.md: $EXTRA_IN_README"
exit 1
fi

# Check for missing READMEs
for pkg in packages/*/; do
if [ ! -f "${pkg}README.md" ]; then
echo "❌ Missing README.md in ${pkg}"
exit 1
fi
done

echo "✅ All package documentation is valid"
Loading