name: Vale Lint

on:
  pull_request:
    paths:
      - 'docs-website/docs/**'

permissions:
  contents: read
  pull-requests: write

jobs:
  vale:
    name: Run Vale
    runs-on: ubuntu-slim
    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: '20'

      # mdx2vast is needed to support mdx files: https://vale.sh/docs/formats/mdx
      - name: Install mdx2vast
        run: npm install -g mdx2vast

      - name: Vale
        uses: errata-ai/vale-action@v2
        with:
          vale_flags: "--config=docs-website/.vale.ini"
          files: docs-website/docs
          reporter: github-pr-review
          fail_on_error: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        continue-on-error: true
