forked from Slimefun/Slimefun4
-
-
Notifications
You must be signed in to change notification settings - Fork 73
86 lines (78 loc) · 2.84 KB
/
spotless.yml
File metadata and controls
86 lines (78 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Spotless
on:
push:
branches: [ master, dev ]
paths:
- 'src/**'
- 'build.gradle.kts'
- 'settings.gradle.kts'
- 'gradle/libs.versions.toml'
pull_request:
types: [ opened, synchronize, reopened ]
paths:
- 'src/**'
- 'build.gradle.kts'
- 'settings.gradle.kts'
- 'gradle/libs.versions.toml'
workflow_dispatch:
env:
TZ: 'Asia/Shanghai'
jobs:
spotless:
runs-on: ubuntu-latest
outputs:
spotless-status: ${{ steps.spotless-check.outputs.status }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Make gradlew executable
run: chmod +x gradlew
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: ${{ vars.JAVA_CI_VERSION || 21 }}
java-package: jdk
architecture: x64
cache: gradle
- name: Spotless check
id: spotless-check
run: |
set +e
./gradlew spotlessCheck --no-daemon
STATUS=$?
echo "status=$STATUS" >> $GITHUB_OUTPUT
set -e
exit $STATUS
continue-on-error: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
- name: Spotless apply (if needed)
id: spotless-apply
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'dev' && steps.spotless-check.outputs.status != '0' }}
run: ./gradlew spotlessApply --no-daemon
- name: Push changes
uses: EndBug/add-and-commit@v9.1.4
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'dev' && steps.spotless-check.outputs.status != '0' && success()}}
with:
github_token: ${{ secrets.BOT_ACCESS_TOKEN }}
add: '.'
push: true
message: 'chore(style): spotless apply'
author_name: 'noraincity-bot'
author_email: ${{ secrets.BOT_EMAIL }}
committer_name: 'noraincity-bot'
committer_email: ${{ secrets.BOT_EMAIL }}
call-dev-ci:
needs: [ spotless ]
if: ${{ needs.spotless.outputs.spotless-status == '0' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'dev' }}
uses: ./.github/workflows/dev-ci.yml
secrets: inherit
call-beta-ci:
needs: [ spotless ]
if: ${{ needs.spotless.outputs.spotless-status == '0' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'master' }}
uses: ./.github/workflows/build-ci.yml
secrets: inherit
call-pr-checker:
needs: [ spotless ]
if: ${{ needs.spotless.outputs.spotless-status == '0' && github.event_name == 'pull_request' }}
uses: ./.github/workflows/pr-checker.yml
secrets: inherit