-
-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (49 loc) · 1.5 KB
/
code-quality.yml
File metadata and controls
57 lines (49 loc) · 1.5 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
name: Code Quality
on:
push:
branches: [main, develop]
paths:
- '**.ts'
- '**.tsx'
- '**.js'
- '**.jsx'
- '**.json'
- '**.md'
- '.github/workflows/code-quality.yml'
- 'tsconfig.json'
- 'package.json'
# pull_request:
# branches: [main, develop]
permissions:
contents: write
jobs:
quality-check:
name: Code Quality Check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
# Auto-fix formatting on push to main/develop (not on PRs)
# Exclude .github/ to avoid workflow permission issues
- name: Format code
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
run: npx prettier --write . --ignore-path .prettierignore '!.github/**'
- name: Run ESLint
run: npm run lint
- name: Commit formatting changes
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: 'style: fix code formatting [skip ci]'
file_pattern: ':!.github/**'