diff --git a/.github/workflows/_markdown-lint.yml b/.github/workflows/_markdown-lint.yml index 6412de9..b110a0e 100644 --- a/.github/workflows/_markdown-lint.yml +++ b/.github/workflows/_markdown-lint.yml @@ -1,5 +1,5 @@ # Reusable: Markdown Lint -# Generic markdown linting — uses the calling repo's own markdownlint config. +# Uses the calling repo's own markdownlint config, falling back to org defaults. name: _markdown-lint on: @@ -20,6 +20,13 @@ jobs: - name: Checkout uses: actions/checkout@v6 + - name: Apply org-default markdownlint config + if: hashFiles('.markdownlint-cli2.jsonc', '.markdownlint-cli2.yaml', '.markdownlint-cli2.cjs', '.markdownlint-cli2.mjs', '.markdownlint.jsonc', '.markdownlint.json', '.markdownlint.yaml', '.markdownlint.yml', '.markdownlint.cjs', '.markdownlint.mjs') == '' + run: | + curl -sSfL --retry 3 --retry-connrefused \ + "https://raw.githubusercontent.com/${{ github.repository_owner }}/.github/main/configs/.markdownlint-cli2.yaml" \ + -o .markdownlint-cli2.yaml + - name: Run markdownlint uses: DavidAnson/markdownlint-cli2-action@v22 with: diff --git a/configs/.markdownlint-cli2.yaml b/configs/.markdownlint-cli2.yaml new file mode 100644 index 0000000..d854b0e --- /dev/null +++ b/configs/.markdownlint-cli2.yaml @@ -0,0 +1,22 @@ +# Organization-wide markdownlint defaults +# Repos inherit this via the _markdown-lint.yml reusable workflow. +# To override: add a .markdownlint-cli2.yaml to your repo root. +config: + MD013: + line_length: 160 + heading_line_length: 80 + code_block_line_length: 80 + tables: true + strict: true + + # Allow duplicate headings in different sections (standard for changelogs) + MD024: + siblings_only: true + +# Per-file overrides +overrides: + - files: + - "CHANGELOG.md" + config: + # release-please generates long lines with PR links + MD013: false