diff --git a/.github/workflows/java-autoformat.yml b/.github/workflows/java-autoformat.yml index ee04e97c5..67afdf552 100644 --- a/.github/workflows/java-autoformat.yml +++ b/.github/workflows/java-autoformat.yml @@ -27,7 +27,12 @@ jobs: - name: Run spotless run: ./gradlew :spotlessApply + - name: Check for modified files + id: git-check + run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT + - name: Create temporary branch + if: steps.git-check.outputs.modified == 'true' run: | git config --global user.name 'Bram van Heuveln' git config --global user.email 'bram28@users.noreply.github.com' @@ -39,6 +44,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Open pull request + if: steps.git-check.outputs.modified == 'true' uses: peter-evans/create-pull-request@v3 with: title: Automated Java code formatting changes