From 4fb206d29edc68a3bd0e2a4c78888ace5303d809 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Wed, 1 Oct 2025 16:30:17 +0100 Subject: [PATCH] Refactor `markdownlint` workflow * Fix path to `markdownlint.jsonc` * Add `permissions: contents: read` to limit workflow permissions. * Switch Node version to `lts/*` for automatic long-term support updates. * Upgrade actions to latest releases. * Split the Markdown linting step into separate install and run steps. * Install `markdownlint-cli` with CI-friendly flags (`--no-audit` `--no-fund`). * Pin `markdownlint-cli` to version `0.45.0` to avoid potential build breaks when new versions are released. * Run `markdownlint` with an explicit rather than implicit configuration --- .github/workflows/markdownlint.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index d1d703bb9f1..dbf0645c539 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -1,10 +1,13 @@ name: Markdownlint +permissions: + contents: read + on: pull_request: paths: - "**/*.md" - - ".markdownlint.json" + - ".markdownlint.jsonc" - ".github/workflows/markdownlint.yml" - ".github/workflows/markdownlint-problem-matcher.json" - "!eng/**" @@ -13,13 +16,15 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Use Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v5 with: node-version: '20' - - name: Run Markdownlint + - name: Install markdownlint-cli run: | echo "::add-matcher::.github/workflows/markdownlint-problem-matcher.json" - npm i -g markdownlint-cli - markdownlint "**/*.md" \ No newline at end of file + npm install --global --no-audit --no-fund markdownlint-cli@0.45.0 + - name: Run markdownlint + run: | + markdownlint --config ./.markdownlint.jsonc '**/*.md'