-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (68 loc) · 1.97 KB
/
Copy pathci.yml
File metadata and controls
81 lines (68 loc) · 1.97 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
name: CI
on:
pull_request:
concurrency:
group: ci-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
# Detect whether this PR is docs-only, so we can skip heavy jobs
docs-scope:
runs-on: ubuntu-latest
outputs:
docs_only: ${{ steps.check.outputs.docs_only }}
docs_changed: ${{ steps.check.outputs.docs_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: check
run: |
CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
DOCS_ONLY=true
DOCS_CHANGED=false
for f in $CHANGED; do
case "$f" in
docs/*|*.md|.markdownlint-cli2.jsonc)
DOCS_CHANGED=true
;;
*)
DOCS_ONLY=false
;;
esac
done
echo "docs_only=$DOCS_ONLY" >> "$GITHUB_OUTPUT"
echo "docs_changed=$DOCS_CHANGED" >> "$GITHUB_OUTPUT"
# Run docs quality checks when any docs files changed
check-docs:
needs: [docs-scope]
if: needs.docs-scope.outputs.docs_changed == 'true'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Docs lint + link audit
run: npm run docs:check
# Run code checks only when non-docs files changed
test:
needs: [docs-scope]
if: needs.docs-scope.outputs.docs_only != 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Type check
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Unit tests
run: npx vitest run --exclude='**/quality.test.ts' --exclude='**/integration.test.ts'