-
Notifications
You must be signed in to change notification settings - Fork 130
44 lines (42 loc) · 1.16 KB
/
formatter.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
name: Format
on:
push:
paths-ignore:
- "*.txt"
pull_request:
paths-ignore:
- "*.txt"
workflow_dispatch:
jobs:
formatting:
name: Format files
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: 21
- name: Format Java files
run: mvn rewrite:run
- name: Install prettier
run: npm install -g --save-dev --save-exact prettier
- name: Format the rest of the files
run: prettier . --write
- name: Commit changes
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add .
if [[ $(git status --porcelain) ]]; then
git commit -m "style: format codebase"
fi
- name: Push changes
if: github.event_name != 'pull_request'
run: git push