-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (68 loc) · 2.38 KB
/
checkstyle.yml
File metadata and controls
80 lines (68 loc) · 2.38 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
name: Checkstyle
on:
pull_request:
branches:
- main
- develop
push:
branches:
- main
- develop
permissions:
contents: read
pull-requests: write
jobs:
checkstyle:
name: Code Style Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: recursive
token: ${{ secrets.SUBMODULE_TOKEN }}
- name: Set up JDK 21
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
java-version: '21'
distribution: 'temurin'
- name: Cache Gradle packages
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run Checkstyle
run: ./gradlew checkstyleMain --no-daemon
- name: Upload Checkstyle Report
if: failure()
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: checkstyle-report
path: |
build/reports/checkstyle/main.html
build/reports/checkstyle/main.xml
retention-days: 7
- name: Comment PR with Checkstyle Results
if: github.event_name == 'pull_request' && failure()
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const path = require('path');
let comment = '## ⚠️ Checkstyle 위반 사항 발견\n\n';
comment += 'Checkstyle 검사에서 코딩 컨벤션 위반이 발견되었습니다.\n\n';
comment += '### 📋 상세 리포트\n';
comment += '- [Main 소스 리포트 다운로드](../actions/runs/${{ github.run_id }})\n';
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});