# .github/workflows/ci.yml
# 持续集成工作流：用于代码风格检查和链接检查

name: CI

on:
  workflow_dispatch:
  push:
    branches: [ develop, master ]
  pull_request:
    branches: [ develop, master ]

jobs:
  markdown-lint:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v6
      with:
        submodules: recursive
    - name: Setup Node.js
      uses: actions/setup-node@v6
      with:
        node-version: '22'
    - name: Run markdownlint
      run: make lint
    - name: Check local markdown links and anchors
      run: python3 scripts/check-local-links.py
    - name: Check markdown details and summaries
      run: python3 scripts/check-markdown-details.py
    - name: Check docs README structure
      run: python3 scripts/check-doc-structure.py
    - name: Check required directory README and AGENTS files
      run: python3 scripts/check-directory-docs.py
    - name: Check metadata paths and anchors
      run: python3 scripts/check-metadata.py
    - name: Check llms and AI citation paths and anchors
      run: python3 scripts/check-ai-citation.py
  link-checker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          submodules: recursive
      - name: Link Checker
        uses: lycheeverse/lychee-action@v2.8.0
        with:
          args: --verbose --no-progress --config .lychee.toml './**/*.md'
