name: Reusable - Markdown link check

on:
  workflow_call:

permissions:
  contents: read

jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

      - name: Install markdown-link-check
        # https://github.com/tcort/markdown-link-check/issues/297
        run: npm install -g markdown-link-check@3.11.2

      - name: Run markdown-link-check
        run: |
          find . -type f \
                 -name '*.md' \
                 -not -path './CHANGELOG.md' \
                 -not -path './licenses/*' \
                 -not -path '*/build/*' \
               | xargs .github/scripts/markdown-link-check-with-retry.sh
