generated from UoaWDCC/ssr-template
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.15 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
name: Format Code
on:
push:
branches:
- "**"
jobs:
format:
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Format code with Prettier
run: yarn format
- name: Check for changes
id: git_changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
if [ -n "$(git status --porcelain)" ]; then
echo "changes_detected=true" >> "$GITHUB_ENV"
else
echo "changes_detected=false" >> "$GITHUB_ENV"
fi
- name: Commit and push changes
if: ${{ env.changes_detected == 'true' }}
run: |
git add .
git commit -m "Format code with Prettier"
git push