-
-
Notifications
You must be signed in to change notification settings - Fork 16
44 lines (37 loc) · 1.18 KB
/
Copy pathprettier.yml
File metadata and controls
44 lines (37 loc) · 1.18 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
name: Format with Prettier
on:
push:
branches:
- main
pull_request:
paths:
- "**.md"
- "**.html"
- "**.js"
- "**.css"
- ".github/workflows/prettier.yml"
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Checkout Push
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v3
- name: Install prettier
run: npm install --global prettier
- name: Check formatting with Prettier
continue-on-error: true
run: prettier --check "**/*.{md,css,js}"; prettier --check "**/*.html" --print-width 500
- name: Prettify code
run: prettier --write "**/*.{md,css,js}"; prettier --write "**/*.html" --print-width 500
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: "style: Formatted code with Prettier"
default_author: github_actions