-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (34 loc) · 1.14 KB
/
code-quality.yml
File metadata and controls
43 lines (34 loc) · 1.14 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
name: Code Quality
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint-and-format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Validate Node version consistency
run: |
NVMRC_VERSION=$(cat .nvmrc | tr -d '[:space:]')
if ! grep -q "\"node\": \".*${NVMRC_VERSION}" package.json; then
echo "::error::Node version mismatch: .nvmrc specifies ${NVMRC_VERSION} but package.json engines.node doesn't match"
echo "Update package.json engines.node to include version ${NVMRC_VERSION}"
exit 1
fi
echo "Node version ${NVMRC_VERSION} is consistent between .nvmrc and package.json"
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run type check
run: npm run check
- name: Run linter
run: npm run lint
- name: Check formatting
run: npx prettier --check '**/*.{js,jsx,ts,astro,md,mdx}'