name: CI - Docs

on:
  push:
    branches: [main]
    paths:
      - 'docs/internal/**'
      - '*.md'
      - 'upgrade.d/*.md'
      - '.markdownlint.json'
      - '.github/workflows/ci-docs.yml'
  pull_request:
    paths:
      - 'docs/internal/**'
      - '*.md'
      - 'upgrade.d/*.md'
      - '.markdownlint.json'
      - '.github/workflows/ci-docs.yml'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

# Read-only by default: without this the workflow inherits the repository
# default, which is write on nearly everything. Nothing here writes.
permissions:
  contents: read

jobs:
  lint:
    name: Markdown Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

      - name: Run markdownlint
        uses: DavidAnson/markdownlint-cli2-action@21c1be1b93ad9ed58fa840aacc3f279cde2a72ff # v24.2.0
        with:
          config: .markdownlint.json
          globs: |
            docs/internal/**/*.md
            *.md
            upgrade.d/*.md
