-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.25 KB
/
ci.yml
File metadata and controls
49 lines (41 loc) · 1.25 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for docs-only changes
id: docs-check
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files[].path')
else
FILES=$(git diff --name-only HEAD~1 2>/dev/null || echo "")
fi
NON_DOCS=$(echo "$FILES" | grep -vE '\.(md|txt)$|^LICENSE' || true)
if [ -z "$NON_DOCS" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ github.token }}
- uses: actions/setup-node@v4
if: steps.docs-check.outputs.skip != 'true'
with:
node-version: 20
cache: npm
- name: Install dependencies
if: steps.docs-check.outputs.skip != 'true'
run: npm ci
- name: Build
if: steps.docs-check.outputs.skip != 'true'
run: npm run build
- name: Lint
if: steps.docs-check.outputs.skip != 'true'
run: npm run lint