From 02b9a0e4c58134021a18df6939963d8cd5bfabfd 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 | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index eaa9198e55b..8a4917553e4 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@v3 + - uses: actions/checkout@v5 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v5 with: - node-version: '16' - - name: Run Markdownlint + node-version: 'lts/*' + - 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'