@@ -19,32 +19,32 @@ jobs:
1919 ref : ${{ github.event.pull_request.head.ref || github.ref }}
2020 token : ${{ secrets.GITHUB_TOKEN }}
2121
22- - uses : actions/setup-java@v5
23- with :
24- java-version : ' 17'
25- distribution : ' temurin'
26-
27- - name : Setup Gradle
28- uses : gradle/actions/setup-gradle@v5
29-
30- - name : Make gradlew executable
31- run : chmod +x ./gradlew
22+ - uses : actions/setup-java@v5
23+ with :
24+ java-version : ' 17'
25+ distribution : ' temurin'
26+
27+ - name : Setup Gradle
28+ uses : gradle/actions/setup-gradle@v5
29+
30+ - name : Make gradlew executable
31+ run : chmod +x ./gradlew
3232
33- - name : Format (non-fork) or check (fork)
34- run : |
35- if [[ "${{ github.event.pull_request.head.repo.full_name }}" != " ${{ github.repository }}" && "${{ github.event_name }}" == "pull_request " ]]; then
36- ./gradlew ktlintCheck --no-daemon
37- else
38- ./gradlew ktlintFormat --no-daemon
39- fi
33+ - name : Run ktlint
34+ run : |
35+ if [[ "${{ github.event_name }}" == "push" || " ${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
36+ ./gradlew ktlintCheck --no-daemon
37+ else
38+ ./gradlew ktlintFormat --no-daemon
39+ fi
4040
41- - name : Commit formatting changes
42- if : github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
43- run : |
44- if [[ -n $(git status --porcelain) ]]; then
45- git config user.email "github-actions[bot]@users.noreply.github.com"
46- git config user.name "github-actions[bot]"
47- git add .
48- git commit -m "style: apply ktlint formatting [bot]"
49- git push
50- fi
41+ - name : Commit formatting changes
42+ if : github.event_name == 'pull_request' && github. event.pull_request.head.repo.full_name == github.repository
43+ run : |
44+ if [[ -n $(git status --porcelain) ]]; then
45+ git config user.email "github-actions[bot]@users.noreply.github.com"
46+ git config user.name "github-actions[bot]"
47+ git add .
48+ git commit -m "style: apply ktlint formatting [bot]"
49+ git push
50+ fi
0 commit comments