-
-
Notifications
You must be signed in to change notification settings - Fork 34
49 lines (45 loc) · 1.23 KB
/
prettier.yaml
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: Apply Prettier style
on:
pull_request:
paths:
- "docs/**"
- "exploration/**"
- "spec/**"
push:
branches-ignore:
- main
paths:
- "docs/**"
- "exploration/**"
- "spec/**"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout from push
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
- name: Checkout from PR
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/setup-node@v3
with:
node-version: "20.x"
- run: npm install
- run: npm run prettier
- name: git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git add .
- name: git commit & push any changes
run: |
git diff-index --quiet HEAD || (git commit -m "style: Apply Prettier" && git push)