README Check #221
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: README Check | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "packages/cli/src/cli/**" | |
| - "README.md" | |
| workflow_dispatch: | |
| concurrency: | |
| group: readme-check-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| readme-check: | |
| if: github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install Claude Code | |
| run: npm install -g @anthropic-ai/claude-code@latest | |
| - name: Run Claude README Check | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| run: | | |
| claude -p "$(cat <<'EOF' | |
| You are checking whether README.md is still accurate after changes on main. | |
| GROUND TRUTH (read from the repo): | |
| 1. Read packages/cli/src/cli/program.ts to get all registered commands. Note which are registered with { hidden: true } — those should NOT appear in the README command table. | |
| 2. For each command, read the corresponding factory file under packages/cli/src/cli/commands/ to get: | |
| - Command name and subcommand names (e.g. "dashboard open", "site deploy") | |
| - The .description() string for each command/subcommand | |
| 3. Read packages/cli/package.json for: the "name" field (install command) and "engines"."node" if present (Node.js requirement). | |
| COMPARE AGAINST README.md: | |
| - Command table: Every non-hidden command/subcommand must be listed. Use the descriptions from the codebase as the basis for the description in the table. They don't need to match exactly. They should be concise and user-friendly. If a description already exists, only change it if it's factually incorrect. Remove any row for a command that no longer exists. | |
| - Installation section: Package name and Node version mentioned must match package.json. | |
| - Quick start: The example commands (e.g. base44 login, base44 create) must still exist as commands in the codebase. | |
| RULES: | |
| 1. If everything matches, do nothing further and exit. | |
| 2. If you find discrepancies: Edit README.md with the correct content. Do NOT commit or push — a later step handles that. | |
| 3. Only modify README.md. Do not touch any other file. | |
| EOF | |
| )" --allowedTools "Read,Glob,Grep,Write(README.md),Edit(README.md)" | |
| - name: Debug - check README after Claude | |
| run: | | |
| echo "=== git diff README.md after Claude step ===" | |
| git diff README.md || true | |
| - name: Restore lychee cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .lycheecache | |
| key: cache-lychee-${{ github.sha }} | |
| restore-keys: cache-lychee- | |
| - name: Check for broken links in README | |
| id: lychee | |
| uses: lycheeverse/lychee-action@v2 | |
| with: | |
| args: --verbose --no-progress --cache --max-cache-age 1d README.md | |
| output: .lychee-results.json | |
| format: json | |
| fail: false | |
| jobSummary: true | |
| - name: Remove broken links from README | |
| run: bun .github/scripts/fix-broken-links.ts .lychee-results.json README.md | |
| - name: Create PR with README changes | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "=== git status ===" | |
| git status | |
| echo "=== git diff README.md ===" | |
| git diff README.md || true | |
| if git diff --quiet README.md; then | |
| echo "No README changes to commit" | |
| exit 0 | |
| fi | |
| BRANCH="docs/sync-readme-${{ github.sha }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout -b "$BRANCH" | |
| git add README.md | |
| git commit -m "docs: sync README with codebase" | |
| git push origin "$BRANCH" | |
| gh pr create \ | |
| --title "docs: sync README with codebase" \ | |
| --body "Auto-generated by the README Check workflow." \ | |
| --base main \ | |
| --head "$BRANCH" | |
| gh pr merge "$BRANCH" --auto --squash |