name: Check Links

on:
  push:
    branches: [main]
  pull_request:
    paths:
      - "packages/kilo-docs/**"
      - ".github/workflows/docs-check-links.yml"
  schedule:
    # Run daily at 9am UTC
    - cron: "0 9 * * *"
  workflow_dispatch: # Allow manual trigger

jobs:
  link-checker:
    if: github.repository == 'Kilo-Org/kilocode'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6 # kilocode_change

      - name: Link Checker
        uses: Kilo-Org/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411
        with:
          args: "**/*.md"
          workingDirectory: packages/kilo-docs
          fail: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
