File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Format PR Code
2+
3+ on :
4+ pull_request :
5+ types :
6+ - opened
7+ - synchronize
8+ - reopened
9+ - ready_for_review
10+
11+ permissions :
12+ contents : write
13+
14+ jobs :
15+ format :
16+ if : github.event.pull_request.head.repo.full_name == github.repository
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Checkout PR branch
21+ uses : actions/checkout@v4
22+ with :
23+ ref : ${{ github.event.pull_request.head.ref }}
24+ fetch-depth : 0
25+
26+ - name : Set up Java 21
27+ uses : actions/setup-java@v4
28+ with :
29+ distribution : temurin
30+ java-version : " 21"
31+ cache : gradle
32+
33+ - name : Set up Gradle
34+ uses : gradle/actions/setup-gradle@v4
35+
36+ - name : Format Java sources
37+ run : ./gradlew formatJava
38+
39+ - name : Commit formatted changes
40+ run : |
41+ if git diff --quiet; then
42+ echo "No formatting changes detected"
43+ exit 0
44+ fi
45+ git config user.name "github-actions[bot]"
46+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
47+ git add -A
48+ git commit -m "Apply Palantir Java Format"
49+ git push
You can’t perform that action at this time.
0 commit comments