Skip to content

Commit 6037c3b

Browse files
committed
tools: use sparse-checkout in linter jobs
We can reduce out usage by avoiding to download files we don't need.
1 parent 4e1f39b commit 6037c3b

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/linters.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ jobs:
2828
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
2929
with:
3030
persist-credentials: false
31+
sparse-checkout: |
32+
*
33+
!doc/
34+
!lib/
35+
!.github/
36+
!.devcontainer/
37+
sparse-checkout-cone-mode: false
3138
- name: Use Node.js ${{ env.NODE_VERSION }}
3239
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
3340
with:
@@ -43,6 +50,13 @@ jobs:
4350
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
4451
with:
4552
persist-credentials: false
53+
sparse-checkout: |
54+
*
55+
!doc/
56+
!lib/
57+
!.github/
58+
!.devcontainer/
59+
sparse-checkout-cone-mode: false
4660
- name: Set up Python ${{ env.PYTHON_VERSION }}
4761
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
4862
with:
@@ -60,6 +74,13 @@ jobs:
6074
with:
6175
fetch-depth: 0
6276
persist-credentials: false
77+
sparse-checkout: |
78+
*
79+
!doc/
80+
!lib/
81+
!.github/
82+
!.devcontainer/
83+
sparse-checkout-cone-mode: false
6384
- name: Use Node.js ${{ env.NODE_VERSION }}
6485
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
6586
with:
@@ -98,6 +119,13 @@ jobs:
98119
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
99120
with:
100121
persist-credentials: false
122+
sparse-checkout: |
123+
*
124+
!deps/
125+
!src/
126+
!.github/
127+
!.devcontainer/
128+
sparse-checkout-cone-mode: false
101129
- name: Use Node.js ${{ env.NODE_VERSION }}
102130
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
103131
with:
@@ -163,6 +191,11 @@ jobs:
163191
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
164192
with:
165193
persist-credentials: false
194+
sparse-checkout: |
195+
Makefile
196+
tools/pip/
197+
*.py
198+
sparse-checkout-cone-mode: false
166199
- name: Set up Python ${{ env.PYTHON_VERSION }}
167200
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
168201
with:
@@ -181,6 +214,12 @@ jobs:
181214
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
182215
with:
183216
persist-credentials: false
217+
sparse-checkout: |
218+
Makefile
219+
tools/pip/
220+
*.yml
221+
*.yaml
222+
sparse-checkout-cone-mode: false
184223
- name: Use Python ${{ env.PYTHON_VERSION }}
185224
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
186225
with:
@@ -200,6 +239,10 @@ jobs:
200239
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
201240
with:
202241
persist-credentials: false
242+
sparse-checkout: |
243+
tools/lint-sh.mjs
244+
*.sh
245+
sparse-checkout-cone-mode: false
203246
- run: shellcheck -V
204247
- name: Lint Shell scripts
205248
run: tools/lint-sh.mjs .
@@ -210,6 +253,8 @@ jobs:
210253
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
211254
with:
212255
persist-credentials: false
256+
sparse-checkout: .github/CODEOWNERS
257+
sparse-checkout-cone-mode: false
213258
- uses: mszostok/codeowners-validator@7f3f5e28c6d7b8dfae5731e54ce2272ca384592f
214259
with:
215260
checks: files,duppatterns
@@ -221,6 +266,10 @@ jobs:
221266
with:
222267
fetch-depth: 2
223268
persist-credentials: false
269+
sparse-checkout: |
270+
tools/lint-pr-url.mjs
271+
doc/api/
272+
sparse-checkout-cone-mode: false
224273
# GH Actions squashes all PR commits, HEAD^ refers to the base branch.
225274
- run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }}
226275
lint-readme:
@@ -229,6 +278,10 @@ jobs:
229278
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
230279
with:
231280
persist-credentials: false
281+
sparse-checkout: |
282+
README.md
283+
tools/tools/lint-readme-lists.mjs
284+
sparse-checkout-cone-mode: false
232285
- name: Get team members if possible
233286
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 }}
234287
id: team_members

0 commit comments

Comments
 (0)