-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) 路 1.2 KB
/
Copy pathformat.yml
File metadata and controls
49 lines (40 loc) 路 1.2 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: Auto Format Code
on:
push:
branches: [ main, develop, feature/*, bugfix/* ]
jobs:
format:
name: Auto Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: |
frontend/package-lock.json
backend/package-lock.json
- name: Install frontend dependencies
working-directory: ./frontend
run: npm ci
- name: Format frontend code
working-directory: ./frontend
run: npm run format
- name: Install backend dependencies
working-directory: ./backend
run: npm ci
- name: Format backend code
working-directory: ./backend
run: npm run format
- name: Commit formatted code
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git diff --staged --quiet || git commit -m "Auto-format code with Prettier"
git push