name: validate-documentation

on:
  push:
    branches: [ main ]
    paths:
    - '.github/workflows/validate-documentation.yml'
    - '**.md'
    - 'package-lock.json'
    - 'package.json'
    - '.lycheeignore'
  pull_request:
    branches: [ main ]
    paths:
    - '.github/workflows/validate-documentation.yml'
    - '**.md'
    - 'package-lock.json'
    - 'package.json'
    - '.lycheeignore'
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3.3.0
    - uses: lycheeverse/lychee-action@v1.5.4
      with:
        fail: true
      env:
        GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
      if: ${{ !contains(github.event.pull_request.labels.*.name, 'release PR') }}

    - run: npm install

    - run: npm run markdownlint && npm run cspell
