name: Docs

on:
  push:
    branches: [main]
    paths:
      - "**/*.md"
      - "docs/**"
      - "!CHANGELOG.md"

permissions:
  contents: read

concurrency:
  group: ${{ format('{0}-{1}', github.workflow, github.ref) }}
  cancel-in-progress: true

env:
  FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"

jobs:
  docs:
    runs-on: ubuntu-24.04
    timeout-minutes: 20
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          fetch-depth: 1
          fetch-tags: false
          persist-credentials: false
          submodules: false

      - name: Setup Node environment
        uses: ./.github/actions/setup-node-env
        with:
          install-bun: "false"

      - name: Checkout ClawHub docs source
        uses: actions/checkout@v6
        with:
          repository: openclaw/clawhub
          path: clawhub-source
          fetch-depth: 1
          persist-credentials: false

      - name: Check docs
        env:
          OPENCLAW_DOCS_SYNC_CLAWHUB_REPO: ${{ github.workspace }}/clawhub-source
        run: pnpm check:docs
