-
Notifications
You must be signed in to change notification settings - Fork 1.2k
49 lines (41 loc) · 1.14 KB
/
prettier.yml
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: Format Code with Prettier
on:
push:
branches:
- '*'
- '!develop'
pull_request:
branches:
- '*'
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '22'
- name: Install dependencies
run: yarn install
- name: Run Prettier
run: yarn prettier --write .
- name: Check for changes
id: check_changes
run: |
if git diff --quiet; then
echo "No code format changes detected"
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "Code format changes detected"
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check_changes.outputs.changes == 'true'
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git add .
git commit -m "chore: format code with Prettier"
git push