perf(routes): 6 条 ƒ → ● / ○,按 next build 输出验证(CPU 超额修复) #408
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: Content Check | |
| permissions: | |
| contents: read | |
| actions: write | |
| on: | |
| pull_request: | |
| paths: | |
| - "**/*.md" | |
| - "**/*.mdx" | |
| - "source.config.ts" | |
| # 2026-05 i18n URL 段化:mdx 内容从 app/docs/ 迁到 content/docs/ | |
| - "content/docs/**" | |
| - "data/**" | |
| - "tests/**" | |
| - "lib/source.ts" | |
| - "mdx-components.tsx" | |
| - "package.json" | |
| - "pnpm-lock.yaml" | |
| - "next.config.mjs" | |
| - "postcss.config.mjs" | |
| - "tailwind.config.ts" | |
| - "tsconfig.json" | |
| jobs: | |
| check-content: | |
| runs-on: ubuntu-latest | |
| env: | |
| NEXT_TELEMETRY_DISABLED: "1" | |
| CI: "true" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Enable corepack to ensure the exact pnpm version from package.json is used | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: "pnpm" | |
| # Verify pnpm version matches package.json packageManager field | |
| - name: Check pnpm version | |
| run: node scripts/check-pnpm-version.mjs | |
| - run: pnpm install --frozen-lockfile | |
| # Verify lockfile wasn't modified by install | |
| - name: Check lockfile consistency | |
| run: | | |
| if ! git diff --exit-code pnpm-lock.yaml; then | |
| echo "❌ Error: pnpm-lock.yaml was modified after install" | |
| echo "This indicates a pnpm version mismatch or corrupted lockfile" | |
| echo "" | |
| echo "Expected pnpm version from package.json:" | |
| # Use multiple fallback methods to extract version | |
| grep '"packageManager"' package.json | grep -o 'pnpm@[^"]*' || \ | |
| node -e "try { console.log(require('./package.json').packageManager || 'not specified') } catch(e) { console.log('Could not read') }" || \ | |
| echo "Could not extract version" | |
| echo "" | |
| echo "Actual pnpm version:" | |
| pnpm --version || echo "pnpm not found" | |
| exit 1 | |
| fi | |
| echo "✅ Lockfile is consistent" | |
| - name: Run tests | |
| run: pnpm test | |
| # Non-blocking image migration + lint (visibility only) | |
| - name: Migrate images next to MDX (check only) | |
| run: pnpm migrate:images || echo "[warn] migrate:images failed (non-blocking)" | |
| - name: Lint image references (non-blocking) | |
| run: pnpm lint:images || echo "[warn] image lint found issues (non-blocking)" | |
| # Block PR if newly added/modified MDX is missing a proper description. | |
| # Old files are grandfathered via lib/seo-description.ts (Layer 1 fallback); | |
| # this check only fires on changed files in the PR (uses GITHUB_BASE_REF diff). | |
| # leetcode/ and _translated.md are exempt — see scripts/check-frontmatter-description.mjs | |
| - name: Check MDX frontmatter description | |
| run: pnpm check:frontmatter |