-
-
Notifications
You must be signed in to change notification settings - Fork 37
42 lines (42 loc) · 1.2 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
name: Prettier
run-name: "Formatting with Prettier JS"
on:
workflow_dispatch:
push:
branches:
- master
jobs:
format-with-prettier:
name: "Format with Prettier"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.ULTIMAFIA_BOT_ACCESS_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "14.15.1"
- name: Install dependencies
run: npm ci
- name: Run Prettier
run: |
git config user.name ultimafia-bot
git config user.email [email protected]
git diff --name-only ${{ github.event.before }} ${{ github.event.after }} \
| xargs --no-run-if-empty -I {} bash -c "
if test -f {} && [[ {} != react_main/public/* ]]; then
npx prettier --write {}
fi
"
- name: Commit and push changes
run: |
if git diff ${{ github.event.after }} --quiet; then
exit 0
else
git add .
git commit -m "run prettier"
git push
fi