Skip to content

Commit d5811ce

Browse files
committed
Add Format workflow
1 parent 102d89b commit d5811ce

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/format.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Java Code Format
2+
3+
on:
4+
push:
5+
branches:
6+
- 'sdk-automation/models'
7+
8+
jobs:
9+
format:
10+
if: ${{ github.event.commits != null && !startsWith(github.event.head_commit.message, 'style(fmt)') }}
11+
permissions:
12+
contents: write
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
19+
20+
- name: Set up JDK
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '20'
24+
distribution: 'adopt'
25+
26+
- name: Cache Maven packages
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/.m2
30+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
31+
restore-keys: |
32+
${{ runner.os }}-m2-
33+
34+
- name: Run Spotless Apply
35+
run: mvn spotless:apply
36+
37+
- name: Commit and Push Changes
38+
run: |
39+
git config user.name AdyenAutomationBot
40+
git config user.email "${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}"
41+
git add .
42+
if git diff --cached --quiet; then
43+
echo "No changes to commit."
44+
else
45+
git commit -m "style(fmt): code formatted"
46+
git push
47+
fi

0 commit comments

Comments
 (0)