# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# SPDX-License-Identifier: curl

name: Markdown links

on:
  push:
    branches:
      - master
      - '*/ci'
    paths:
      - '.github/workflows/linkcheck.yml'
      - '**.md'
  pull_request:
    branches:
      - master
    paths:
      - '.github/workflows/linkcheck.yml'
      - '**.md'

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
  cancel-in-progress: true

permissions: {}

jobs:
  # Docs: https://github.com/marketplace/actions/markdown-link-check
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        name: checkout

      - name: trim the cmdline docs markdown files
        run: find docs/cmdline-opts -name "*.md" ! -name "_*" ! -name MANPAGE.md | xargs -n1 ./.github/scripts/cleancmd.pl

      - uses: gaurav-nelson/github-action-markdown-link-check@v1
        with:
          use-quiet-mode: 'yes'
