tools: use sparse-checkout in linter jobs

We can reduce out usage by avoiding to download files we don't need.

PR-URL: https://github.com/nodejs/node/pull/61123
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Antoine du Hamel
2025-12-21 11:14:59 +01:00
committed by GitHub
parent a65421a679
commit 01ebb475a4

View File

@@ -163,6 +163,16 @@ jobs:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
sparse-checkout: |
/Makefile
/benchmark/
/doc/
/lib/
/src/node_version.h
/tools/
pyproject.toml
*.py
sparse-checkout-cone-mode: false
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
@@ -181,6 +191,12 @@ jobs:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
sparse-checkout: |
/Makefile
/tools/pip/
*.yml
*.yaml
sparse-checkout-cone-mode: false
- name: Use Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
@@ -200,6 +216,10 @@ jobs:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
sparse-checkout: |
/tools/lint-sh.mjs
*.sh
sparse-checkout-cone-mode: false
- run: shellcheck -V
- name: Lint Shell scripts
run: tools/lint-sh.mjs .
@@ -221,6 +241,10 @@ jobs:
with:
fetch-depth: 2
persist-credentials: false
sparse-checkout: |
/tools/lint-pr-url.mjs
/doc/api/
sparse-checkout-cone-mode: false
# GH Actions squashes all PR commits, HEAD^ refers to the base branch.
- run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }}
lint-readme:
@@ -229,6 +253,10 @@ jobs:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
sparse-checkout: |
README.md
/tools/lint-readme-lists.mjs
sparse-checkout-cone-mode: false
- name: Get team members if possible
if: ${{ (github.event.pull_request && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch) || github.event.ref == github.event.repository.default_branch }}
id: team_members