-
Notifications
You must be signed in to change notification settings - Fork 26.3k
34 lines (32 loc) · 1.12 KB
/
check-format.yml
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
name: Check for formatting
on:
push:
pull_request:
jobs:
check-format:
name: Check if code needs formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Maven
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu
- name: Check if code aligns with code style
id: check
run: mvn spotless:check
continue-on-error: true
- name: Generate Summary
run: |
if [ ${{ jobs.check.result }} == 'success' ]; then
echo ":ballot_box_with_check: No formatting issues found." >> $GITHUB_STEP_SUMMARY
exit 0
else
echo ":negative_squared_cross_mark: Formatting issues found!" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
gh run view ${{ github.run_id }} --log | grep "ERROR" | sed 's/Check if code needs formatting Check if code aligns with code style [0-9A-Z:.-]\+//' | sed 's/\[ERROR] //' >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
exit 1
fi