-
Notifications
You must be signed in to change notification settings - Fork 0
407 lines (356 loc) · 13.7 KB
/
Copy pathci.yaml
File metadata and controls
407 lines (356 loc) · 13.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
name: CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
determine-changes:
name: Determine changed files
runs-on: ubuntu-latest
outputs:
github_actions: ${{ steps.changed-files.outputs.github_actions_any_changed }}
github_actions_ci: ${{ steps.changed-files.outputs.github_actions_ci_any_changed }}
renovate_config: ${{ steps.changed-files.outputs.renovate_config_any_changed }}
md: ${{ steps.changed-files.outputs.md_any_changed }}
json5: ${{ steps.changed-files.outputs.json5_any_changed }}
json5_files: ${{ steps.changed-files.outputs.json5_all_changed_files }}
toml: ${{ steps.changed-files.outputs.toml_any_changed }}
yaml: ${{ steps.changed-files.outputs.yaml_any_changed }}
steps:
- name: Checkout the main repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Determine changed files
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files_yaml: |
github_actions:
- .github/workflows/**
github_actions_ci:
- .github/workflows/ci.yaml
renovate_config:
- .github/renovate.json5
md:
- '**/*.md'
- .markdownlint-cli2.yaml
json5:
- '**/*.json5'
toml:
- '**/*.toml'
- .tombi.toml
yaml:
- '**/*.yml'
- '**/*.yaml'
- .yamllint.yaml
lint-gh-actions:
name: Lint GitHub Actions
needs: determine-changes
if: ${{ needs.determine-changes.outputs.github_actions == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
security-events: write
steps:
- name: Checkout the main repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Run actionlint
if: github.event_name != 'pull_request'
run: |
go install github.com/rhysd/actionlint/cmd/actionlint@914e7df21a07ef503a81201c76d2b11c789d3fca # v1.7.12
"$(go env GOPATH)/bin/actionlint" -color
- name: Run actionlint (reviewdog)
if: github.event_name == 'pull_request'
uses: reviewdog/action-actionlint@6fb7acc99f4a1008869fa8a0f09cfca740837d9d # v1.72.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
fail_level: error
- name: Run zizmor
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
with:
version: 'v1.24.1'
online-audits: false
advanced-security: false
annotations: true
- name: Run zizmor (SARIF upload)
if: >-
${{
always() &&
github.event.repository.private == false &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
}}
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
with:
version: 'v1.24.1'
online-audits: false
advanced-security: true
# validate-renovate-config:
# name: Validate Renovate config
# needs: determine-changes
# if: >-
# ${{ needs.determine-changes.outputs.renovate_config == 'true' ||
# needs.determine-changes.outputs.github_actions_ci == 'true' }}
# runs-on: ubuntu-latest
# permissions:
# contents: read
# steps:
# - name: Checkout the main repository
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# persist-credentials: false
# - name: Set up Node.js
# uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
# with:
# node-version: 24
# - name: Validate Renovate config
# run: |
# npx --yes --package renovate@43.150.0 \
# renovate-config-validator .github/renovate.json5
# lint-markdown:
# name: Lint Markdown
# needs: determine-changes
# if: >-
# ${{ needs.determine-changes.outputs.md == 'true' ||
# needs.determine-changes.outputs.github_actions_ci == 'true' }}
# runs-on: ubuntu-latest
# permissions:
# contents: read
# pull-requests: write
# steps:
# - name: Checkout the main repository
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# persist-credentials: false
# - name: Lint Markdown
# if: github.event_name != 'pull_request'
# run: npx --yes markdownlint-cli2@0.22.1 .
# - name: Set up reviewdog
# if: github.event_name == 'pull_request'
# uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0
# with:
# reviewdog_version: 'v0.21.0'
# - name: Lint Markdown (reviewdog)
# if: github.event_name == 'pull_request'
# env:
# REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# markdownlint_rc=0
# npx --yes markdownlint-cli2@0.22.1 . > /tmp/markdownlint-report.txt 2>&1 || markdownlint_rc=$?
# reviewdog_rc=0
# reviewdog < /tmp/markdownlint-report.txt \
# -efm="%f:%l:%c %m" \
# -efm="%f:%l %m" \
# -name=markdownlint \
# -reporter=github-pr-review \
# -fail-level=error || reviewdog_rc=$?
# if [ $markdownlint_rc -ne 0 ] && ! grep -Eq '^[^:]+:[0-9]+(:[0-9]+)? ' /tmp/markdownlint-report.txt; then
# echo "::error title=markdownlint::markdownlint failed before producing parseable diagnostics"
# exit $markdownlint_rc
# fi
# exit $reviewdog_rc
# lint-json5:
# name: Lint JSON5
# needs: determine-changes
# if: >-
# ${{ needs.determine-changes.outputs.json5 == 'true' ||
# needs.determine-changes.outputs.github_actions_ci == 'true' }}
# runs-on: ubuntu-latest
# permissions:
# contents: read
# steps:
# - name: Checkout the main repository
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# persist-credentials: false
# - name: Check JSON5 syntax
# env:
# CHANGED_JSON5_FILES: ${{ needs.determine-changes.outputs.json5_files }}
# run: |
# readarray -t json5_files < <(
# printf '%s\n' "${CHANGED_JSON5_FILES}" | tr ' ' '\n' | sed '/^$/d'
# )
# if [ ${#json5_files[@]} -eq 0 ]; then
# readarray -d '' -t json5_files < <(
# find . -type f -name '*.json5' -not -path './.git/*' -print0
# )
# fi
# if [ ${#json5_files[@]} -eq 0 ]; then
# echo 'No JSON5 files found.'
# exit 0
# fi
# exit_code=0
# for json5_file in "${json5_files[@]}"; do
# npx --yes json5@2.2.3 --validate "$json5_file" || exit_code=1
# done
# exit $exit_code
# lint-toml:
# name: Lint TOML
# needs: determine-changes
# if: >-
# ${{ needs.determine-changes.outputs.toml == 'true' ||
# needs.determine-changes.outputs.github_actions_ci == 'true' }}
# runs-on: ubuntu-latest
# permissions:
# contents: read
# pull-requests: write
# steps:
# - name: Checkout the main repository
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# persist-credentials: false
# - name: Install Tombi
# uses: tombi-toml/setup-tombi@df24458044353545055a12fe0d0742df9d3c5bea # v1.1.2
# with:
# version: '1.1.2'
# - name: Lint TOML
# if: github.event_name != 'pull_request'
# run: tombi lint
# - name: Set up reviewdog
# if: github.event_name == 'pull_request'
# uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0
# with:
# reviewdog_version: 'v0.21.0'
# - name: Lint TOML (reviewdog)
# if: github.event_name == 'pull_request'
# env:
# REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NO_COLOR: '1'
# run: |
# lint_rc=0
# tombi lint --quiet > /tmp/tombi-lint-report.txt 2>&1 || lint_rc=$?
# gawk '
# match($0, /^[[:space:]]*(Warning|Error):[[:space:]]*(.*)$/, m) {
# severity = m[1]; message = m[2]; next
# }
# match($0, /^[[:space:]]*at[[:space:]]+(.*):([0-9]+):([0-9]+)/, m) {
# printf "%s:%s:%s: %s: %s\n", m[1], m[2], m[3], substr(severity, 1, 1), message
# }
# ' /tmp/tombi-lint-report.txt > /tmp/tombi-lint-report.efm.txt
# reviewdog_rc=0
# reviewdog < /tmp/tombi-lint-report.efm.txt \
# -efm="%f:%l:%c: %t: %m" \
# -name=tombi-lint \
# -reporter=github-pr-review \
# -fail-level=error || reviewdog_rc=$?
# if [ $lint_rc -ne 0 ] && [ ! -s /tmp/tombi-lint-report.efm.txt ]; then
# echo "::error title=tombi::tombi lint failed before producing parseable diagnostics"
# cat /tmp/tombi-lint-report.txt
# exit $lint_rc
# fi
# exit $reviewdog_rc
# - name: Format TOML
# run: tombi format
# - name: Suggest TOML format changes (reviewdog)
# if: github.event_name == 'pull_request'
# uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # v1.24.0
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# tool_name: tombi-format
# cleanup: 'false'
# - name: Check TOML format
# run: git diff --exit-code
# lint-yaml:
# name: Lint YAML
# needs: determine-changes
# if: >-
# ${{ needs.determine-changes.outputs.yaml == 'true' ||
# needs.determine-changes.outputs.github_actions_ci == 'true' }}
# runs-on: ubuntu-latest
# permissions:
# contents: read
# pull-requests: write
# steps:
# - name: Checkout the main repository
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# persist-credentials: false
# - name: Install uv
# if: github.event_name != 'pull_request'
# uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
# with:
# version: '0.11.16'
# - name: Lint YAML
# if: github.event_name != 'pull_request'
# run: uvx --from "yamllint==1.38.0" yamllint .
# - name: Lint YAML (reviewdog)
# if: github.event_name == 'pull_request'
# uses: reviewdog/action-yamllint@f01d8a48fd8d89f89895499fca2cff09f9e9e8c0 # v1.21.0
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# reporter: github-pr-review
# fail_level: error
# yamllint_flags: .
check-prek:
name: Check prek
runs-on: ubuntu-latest
steps:
- name: Checkout the main repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Check prek
uses: j178/prek-action@bdca6f102f98e2b4c7029491a53dfd366469e33d # v2.0.4
with:
prek-version: 'v0.4.1'
extra-args: '--all-files --skip no-commit-to-branch'
# check-typos:
# name: Check typos
# runs-on: ubuntu-latest
# permissions:
# contents: read
# checks: write
# pull-requests: write
# steps:
# - name: Checkout the main repository
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# persist-credentials: false
# - name: Check spelling
# if: github.event_name != 'pull_request'
# uses: crate-ci/typos@aca895bf05aec0cb7dffa6f94495e923224d9f17 # v1.46.2
# with:
# files: |
# .
# .github/**
# - name: Check spelling (reviewdog)
# if: github.event_name == 'pull_request'
# uses: reviewdog/action-typos@d5eb1bbcd1b3bfde596f6eeb470322727862fe98 # v1.19.0
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# reporter: github-pr-review
# fail_level: error
# typos_flags: --hidden .
# lint-commit-messages:
# name: Lint commit messages
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the main repository
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# fetch-depth: 0
# persist-credentials: false
# - name: Set up Commitizen
# uses: commitizen-tools/setup-cz@96c75e6ae9632047f2c9b4025b9dd1624b40de8f # v0.9.1
# with:
# python-version: '3.x'
# version: '4.16.2'
# - name: Lint commit messages on push
# if: github.event_name == 'push'
# run: cz check --rev-range ${{ github.event.before }}..${{ github.sha }}
# - name: Lint commit messages on pull request
# if: github.event_name == 'pull_request'
# run: cz check --rev-range ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}