Skip to content

Commit 0b3cc7c

Browse files
committed
prettier check on PR
1 parent 1109fe1 commit 0b3cc7c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/prettier.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Prettier Autofix
33
on:
44
push:
55
branches: ["**"]
6+
pull_request:
7+
branches: ["main"]
68

79
permissions:
810
contents: write
@@ -24,8 +26,19 @@ jobs:
2426

2527
- name: Run Prettier
2628
run: npx prettier --write "kubejs/**/*.{js,json}"
29+
continue-on-error: false
2730

2831
- name: Commit changes
32+
if: github.event_name == 'push'
2933
uses: stefanzweifel/git-auto-commit-action@v5
3034
with:
31-
commit_message: "chore: format with Prettier"
35+
commit_message: "chore: prettier formatting"
36+
37+
- name: Check for formatting changes
38+
if: github.event_name == 'pull_request'
39+
run: |
40+
if ! git diff --exit-code; then
41+
echo "::notice::Some files are not properly formatted. You may want to run prettier locally. This will also get auto fixed on commit."
42+
else
43+
echo "::notice::All files are properly formatted."
44+
fi

0 commit comments

Comments
 (0)