Feat/be/76 "tour tool 프롬프트 및 전체 프롬프트 정제화 및 레디스 설정 가이드 수정" #62
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AI Code Review | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| jobs: | |
| ai-review: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/github-script@v7 | |
| env: | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| with: | |
| script: | | |
| const diff = await github.rest.repos.compareCommits({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| base: context.payload.pull_request.base.sha, | |
| head: context.payload.pull_request.head.sha | |
| }); | |
| const kotlinFiles = diff.data.files.filter(file => | |
| (file.filename.endsWith('.kt') || file.filename.endsWith('.kts')) && file.patch | |
| ); | |
| if (kotlinFiles.length === 0) return; | |
| for (const file of kotlinFiles.slice(0, 3)) { | |
| const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { | |
| method: 'POST', | |
| headers: { | |
| 'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`, | |
| 'Content-Type': 'application/json' | |
| }, | |
| body: JSON.stringify({ | |
| model: 'x-ai/grok-4-fast:free', | |
| messages: [{ | |
| role: 'system', | |
| content: `코드 리뷰어입니다. 다음 규칙을 검토하세요: | |
| ## 필수 검토 항목 | |
| 1. **글로벌 익셉션 처리**: @ControllerAdvice 사용, 표준 에러 응답 | |
| 2. **ApiResponse 사용**: 모든 API는 ApiResponse<T>로 감싸서 응답 | |
| 3. **Kotlin 최적화**: data class, null safety, when 표현식, 확장함수 등 | |
| 4. **ktlint 규칙**: 포맷팅, 네이밍 컨벤션 | |
| ## 응답 형식 | |
| 🟢 **좋은점**: [규칙을 잘 지킨 부분] | |
| 🟡 **개선사항**: [더 좋게 할 수 있는 부분] | |
| 🔴 **문제점**: [반드시 수정해야 할 부분]` | |
| }, { | |
| role: 'user', | |
| content: `파일: ${file.filename}\n\n변경사항:\n${file.patch}` | |
| }], | |
| max_tokens: 500, | |
| temperature: 0 | |
| }) | |
| }); | |
| if (response.ok) { | |
| const result = await response.json(); | |
| const review = result.choices[0].message.content; | |
| await github.rest.pulls.createReview({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.payload.pull_request.number, | |
| body: `## 🤖 AI 리뷰 - \`${file.filename}\`\n\n${review}`, | |
| event: 'COMMENT' | |
| }); | |
| } | |
| } |