Skip to content

Commit c1c3550

Browse files
authored
fix(markdown-lint): run markdownlint standalone / avoid EBADENGINE error (#110)
Avoids causing failing PR checks in workflow-reusing repositories, such as `advanced-security/codeql-development-mcp-server` repo. Fixes the cause of the EBADENGINE error for cases where: - `npm ci` ran on the runner's default Node against the *calling* repo; - the following settings are configured in files in *calling* repo root: - `engine-strict=true` in `.npmrc`, AND - `engines` range in `package.json` above the runner's default Node version. Summary of changes in this commit: - Drop the `npm ci` step; fetch a pinned `markdownlint-cli@0.49.1` via `npx` - Add `actions/setup-node` on Node 24 with `package-manager-cache: false` - Pass `--ignore-scripts` so no lifecycle script runs while fetching the linter - Set `persist-credentials: false` on checkout - Pin `actions/checkout` to a commit SHA and annotate the `paths-filter` pin
1 parent f4156a2 commit c1c3550

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Markdown Lint'
1+
name: Markdown Lint
22

33
on:
44
pull_request:
@@ -12,22 +12,36 @@ jobs:
1212
markdown-lint:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: 'Checkout Repository'
16-
uses: actions/checkout@v7
15+
- name: Checkout Repository
16+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
17+
with:
18+
persist-credentials: false
1719

18-
- name: "Filter Changes"
19-
uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706
20+
- name: Filter Changes
21+
uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2
2022
id: changes
2123
with:
2224
filters: |
2325
src:
2426
- '**/*.md'
2527
26-
- name: "Install Dependencies"
28+
- name: Setup Node.js
2729
if: steps.changes.outputs.src == 'true'
28-
run: npm ci
30+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
31+
with:
32+
# pinned major: a required check should not follow LTS rollovers
33+
node-version: '24'
34+
# nothing below runs `npm ci`, so the caller's npm cache is dead weight
35+
package-manager-cache: false
2936

30-
# lint markdown
31-
- name: "Lint Markdown"
37+
# markdownlint-cli is run standalone so this reusable workflow never installs the
38+
# caller's dependencies, whose `engines`, lockfile, or `.npmrc` (e.g.
39+
# `engine-strict=true`) can fail `npm ci` here. The registry is left to the
40+
# caller's `.npmrc`, but `--ignore-scripts` outranks it and cannot be re-enabled.
41+
- name: Lint Markdown
3242
if: steps.changes.outputs.src == 'true'
33-
run: npx markdownlint-cli '**/*.md' --ignore node_modules --disable MD013
43+
run: |-
44+
npx --yes --ignore-scripts markdownlint-cli@0.49.1 \
45+
'**/*.md' \
46+
--ignore node_modules \
47+
--disable MD013

0 commit comments

Comments
 (0)