Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/format/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Format Java Code'
description: 'Runs mvn spotless:apply'
inputs:
path:
description: 'Path to the java repository'
required: true
runs:
using: 'composite'
steps:
- name: Set up JDK 11 for formatting
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v4.2.1
with:
java-version: '11'
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.0.2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles(format('{0}/**/pom.xml', inputs.path)) }}
restore-keys: |
${{ runner.os }}-m2-

- name: Run Spotless Apply
run: mvn spotless:apply
shell: bash
working-directory: ${{ inputs.path }}
23 changes: 4 additions & 19 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Java Code Format
name: Format and Commit Java Code

on:
workflow_dispatch:
push:
branches:
- 'sdk-automation/*'

permissions:
contents: write
Expand All @@ -19,22 +16,10 @@ jobs:
with:
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}

- name: Set up JDK
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
- name: Format Java Code
uses: ./.github/actions/format
with:
java-version: '20'
distribution: 'adopt'

- name: Cache Maven packages
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-

- name: Run Spotless Apply
run: mvn spotless:apply
path: .

- name: Commit and Push Changes
env:
Expand Down