File tree Expand file tree Collapse file tree 1 file changed +39
-3
lines changed
Expand file tree Collapse file tree 1 file changed +39
-3
lines changed Original file line number Diff line number Diff line change 1313 paths :
1414 - " **/*.java"
1515
16- permissions :
17- contents : write
18-
1916jobs :
2017 format :
2118 if : github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
2219 runs-on : ubuntu-latest
20+ permissions :
21+ contents : write
2322
2423 steps :
2524 - name : Checkout branch
5958 git add -A
6059 git commit -m "Apply Palantir Java Format"
6160 git push
61+
62+ check-format :
63+ if : github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
64+ runs-on : ubuntu-latest
65+ permissions :
66+ contents : read
67+
68+ steps :
69+ - name : Checkout branch
70+ uses : actions/checkout@v4
71+
72+ - name : Set up Java 21
73+ uses : actions/setup-java@v4
74+ with :
75+ distribution : temurin
76+ java-version : " 21"
77+ cache : gradle
78+
79+ - name : Expose Java 21 to Gradle toolchains
80+ run : |
81+ echo "JAVA_HOME=$JAVA_HOME" >> "$GITHUB_ENV"
82+ echo "ORG_GRADLE_JAVA_INSTALLATIONS_PATHS=$JAVA_HOME" >> "$GITHUB_ENV"
83+ java -version
84+ javac -version
85+
86+ - name : Set up Gradle
87+ uses : gradle/actions/setup-gradle@v4
88+
89+ - name : Check Java formatting
90+ run : ./gradlew checkFormatJava
91+
92+ - name : Explain how to fix formatting
93+ if : failure()
94+ run : |
95+ echo "Java formatting check failed."
96+ echo "This pull request comes from a fork, so CI cannot push formatting commits back to the branch."
97+ echo "Run './gradlew formatJava' locally and push the formatted changes to update the PR."
You can’t perform that action at this time.
0 commit comments