diff --git a/.github/actions/format/action.yml b/.github/actions/format/action.yml new file mode 100644 index 000000000..7417ffc5b --- /dev/null +++ b/.github/actions/format/action.yml @@ -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 20 for formatting + uses: actions/setup-java@v4 + with: + java-version: '20' + distribution: 'adopt' + + - name: Cache Maven packages + uses: actions/cache@v4 + 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 }}